any cross browser javascript/jquery to detect if browser is closing tab or closed browser ? and should not activate event when go to other link?
+3
A:
If I get you correctly, you want to know when a tab/window is effectivly closed. Well, afaik your only way in Javascript to detect that kind of stuff are onunload & onbeforeunload events.
Unfortunalty (or fortunatly?), those events are also fired when you leave a site over a link or your browsers back button. So this is the best answer I can give, I don't think you can natively detect a pure close in Javascript. Correct me if I'm wrong here.
jAndy
2010-10-08 08:39:46
Correct. You can only detect when the page is unloaded, not when the window is closed. Also, the onbeforeunload is non-standard, so it's not supported by all browsers.
Guffa
2010-10-08 08:45:24