If onbeforeunload returns true-ish, the browser will put up a dialog with the results of that true-ish value being cast to a string interpolated inside the standard dialog. There is no need to have confirm in there as well. Try either returning false if all is well, or a string with your message if not.
Many modern browsers have this behavior anyway -- if you try to leave a page after filling out form elements, you get this dialog for free. Walter On Jan 11, 2013, at 1:41 AM, sreekal...@tech4travel.co.in wrote: > I tried this code before window close.But again i get a pop up like " This > page is asking you to confirm that you want to leave - data you have entered > may not be saved".Two pop-ups are not needed. > window.onbeforeunload = function() { > var r=confirm("Are you sure you want to navigate away?"); > if (r==false) > { > return false; > } > > } > > > > -- > You received this message because you are subscribed to the Google Groups > "Prototype & script.aculo.us" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/prototype-scriptaculous/-/o0lXyGlNh4cJ. > To post to this group, send email to prototype-scriptaculous@googlegroups.com. > To unsubscribe from this group, send email to > prototype-scriptaculous+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.