Forum Moderators: open

Message Too Old, No Replies

email link to activate server side script

         

kapow

1:34 pm on Dec 12, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How do I get an email link to activate a server side script when the link is clicked? e.g.

<a href="mailto:kapow@mydomain.com" onClick="......">Kapow</a>

where the script is something like this:
<? include('myfile.php'); SoAndSo();?>

seindal

2:41 pm on Dec 12, 2002 (gmt 0)

10+ Year Member



Hi,

I have never tried it and I don't know how the various browsers will react, but why don't you reverse the process. Let the link go to your script, and when the script is done, send a redirect to a mailto url.

It is just an untested idea, but maybe worth trying.

Otherwise you're in for some javascript and (i)frames fiddling. You could place a really small iframe somewhere on the page, and have the onClick handler submit a form into that iframe. That way you get the mailto link and a script activated on the server side. It'll cost you a superflous iframe, that only serves as the client side target for the output of the script, which could always be a 204 HTTP response (No change).

I hope this helps you.

René.

korkus2000

2:48 pm on Dec 12, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you tried something like

<script>
function emailLoads(){
window.location = "mailto:whatever@whatever.com";
window.location = "#open-mail-and-new-page";
}
</script>

<a href="javascript:emailLoads()">email me</a>

this worked in IE6 didn't test it anywhere else. This allows the mailto to open and hit the server for the server-side code.

kapow

10:57 am on Dec 13, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How about making the text-link submit a form, where the form processes the server side code?

Can a text link both submit a form and send an email?

korkus2000

1:05 pm on Dec 13, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In theory you can, but the Jscript submit property has become buggy in IE6. I have seen intermitent problems that appearently have to do with user settings. I have a web app that broke because of it. I would suggest looking at another option.