Is there anyway to prevent onbeforeunload event from triggering when using internet explorer
Posted
by newName
on Stack Overflow
See other posts from Stack Overflow
or by newName
Published on 2010-05-04T08:25:34Z
Indexed on
2010/05/04
8:38 UTC
Read the original article
Hit count: 400
I have a function that is suppose to trigger when user closes their browser and I have put the code in the "window.onbeforeunload" function.
The thing is every time if I reloads the page in Internet Explorer, the onbeforeunload event will also trigger which is a problem because I only wants it to trigger only when the user closes or navigates away from the current page but not on a page refresh/reload.
Therefore I'm not sure if onbeforeunload is intended to trigger even on a page refresh/reload and if it is intended to, then is there another way to work round it? Thanks
© Stack Overflow or respective owner