If your have your click setup similar to something like this:
or, if you’re using ASP.NET’s HyperLink control:
And your “doStuff()” function doesn’t redirect or closes the window – you’d expect it just do its stuff and that’s it. But in addition to it, or rather before it onbeforeunload event fires, so if you have some code in the event handler – it will be executed, which in this case is undesirable.
<span style="color:blue;text-decoration:underline;cursor:hand" onclick="doStuff()"> Click to do something </span>
Notice style attribute used to simulate hyperlink appearance including underline and hand cursor.