Click here to Skip to main content
15,903,856 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am using the code but default msg alert only display like"Changes you made may not be saved". Refresh my page that time how to display my own comments display alert in my browser.

What I have tried:

$(window).on('beforeunload', function () { return 'Please Stay On This Page'; });
Posted
Updated 5-Oct-17 20:48pm

1 solution

If i understand your question correctly, what your wanting to do is customize the "Change you've made may not be saved message".

This is now considered a security issue and is no longer allowed given the ability to customize the messages in a malicious way.

WindowEventHandlers.onbeforeunload - Web APIs | MDN[^]

javascript - How to show the "Are you sure you want to navigate away from this page?" when changes committed? - Stack Overflow[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900