Whenever I leave a page as in exit the page like click the cross button or cancel button it should ask for confirmation -Do i want to navigate from the page(Yes/No) If No, it should remain on the same page. This is easy to implement on MOSS 2007 using onbeforeunload event using Jquery. But 2010 all pages namely Newform, Editform and DisplayForm are Modal Dialog and I am not able to use this event efficiently.

Please help.

2 Answers 2


You could go into the settings of the list or library and set them to open in the browser instead. Then you should be able to do this.

  • but will tat give me a confirmation ?
    – Anji
    Jun 27, 2011 at 3:50

If you want this behavior on every single form in your Site Collection, you can certainly do it with jQuery added to the master page. It's just a matter of getting the selectors right. You'll need to handle the buttons on forms which are displayed in dialogs as well as those which are not.

However, might I suggest that you will drive your users absolutely batty with this "enhancement"?

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.