Link to home
Start Free TrialLog in
Avatar of Vasanth_Kumar
Vasanth_Kumar

asked on

How to send an Email in JavaScript function which will be called when onUnload event occured?

I have to send an Email in java script function which will be called when onUnload event occured.
Avatar of netsmithcentral
netsmithcentral
Flag of United States of America image

You can call a mailto: link onunload, but that only opens the e-mail in the client's email program of choice.  To send an e-mail discreetly (no user interaction) you have to use server side scripting.
Avatar of Vasanth_Kumar
Vasanth_Kumar

ASKER

To send an e-mail discreetly (no user interaction) ,I have to use server side scripting.Can we execute that server side scripting in javascript function which will be called when onUnload event occured?

My actual requirement is that when i am leaving the current page to another page by clicking back or forward buttons
and by closing the window and by clicking any one of the href links in the current page , then i have to send the Email.
Can u give me the idea how to do that.
ASKER CERTIFIED SOLUTION
Avatar of Mobinex
Mobinex

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Michel Plungjan
And to make sure you send it, you would have to open the fully qualified url to the program in a new window which can be blocked by popup blockers...
I will want to see the ajax method actually run over the net on a standard box since onUnload may unload all scripts before they are executed

What is the aim of this email?