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

0

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

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.
You can add logic to disable it when they click certain elements.
This event will fire when you close window / tab or navigating to another page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.