javascript - Can I override onbeforeunload for a particular element? -
i have page quite bit of work , don't want user able navigate away page (close browser, hit button, etc.) without getting warning. found onbeforeunload event (which think ie-specific, works fine me project uses lots of activex) works great. problem is, want user able click on little "help" icon in upper-right corner , pop window @ time. causes onbeforeunload fire, though main window never goes anywhere , page never unloads. the javascript function runs when onbeforeunload event runs puts text event.returnvalue. if ascertain, somehow, icon 1 clicked not put text event.returnvalue in situation. how have page figure out? let me guess: "icon" link javascript: url? change real button, real link, or @ least put functionality in onclick event handler (that prevents default behavior). problem solved. <!-- clicking link nothing. no onbeforeunload handler triggered. nothing. , put in before return false bit... ...and onunload handler still not cal...