I was just going through the onneforeunload property here:
http://www.4guysfromrolla.com/demos/...nloadDemo1.htm
Now , consider a scenario such as this :
my website is located at say www.mywebsite.com which has several web pages for which i want to have the onneforeunload event . Now , assume that all the web pages are including a js file where i can have the code for the event which is like this :
Expand|Select|Wrap|Line Numbers
- var needToConfirm = true;
- window.onbeforeunload = confirmExit;
- function confirmExit()
- {
- // Handle what to do
- }
1) Tab is closed
2) User navigates to another page within the same websote.
3) window is closed
4) User navigates to another page outside the domain of www.mywebsite.com
How to handle all these cases separately? To be more specific , how can i tell whether the user has navigated within or outside the domain of the website?
Any help appreciated.
Regards,
Rhitam