Postback javascript

Go To StackoverFlow.com

0

when the user leaves the page I want to give message do you want to leave. I am handling this in function pageUnload() event in javascript.But I don't want to call this in the page postback I want to call when they navigate to different page

2012-04-05 14:43
by user933316


1

Look into window.onbeforeunload.

Note that Firefox 4 and up will not present the custom message to the user (but they do present a dialog asking if the user wants to leave). Safari, Chrome, and IE will.

2012-04-05 14:45
by ceejayoz
Hi,Thx.but this too will fire when I submit my page.I want this to fire when the user moves to different page.But If i post back the page for some search it will fire that time too.I want to fire only if the user moves to different page not in postback - user933316 2012-04-05 15:07
You can add logic to disable it when they click certain elements - ceejayoz 2012-04-05 15:13
This event will fire when you close window / tab or navigating to another page - Pankaj 2012-04-05 16:39
Ads