Reputation: 1736
I had tried to return my custom message to onbeforeunload confirm box, but default message didn't change what I sent.
window.onbeforeunload = function (event) {
event.preventDefault();
return 'You are leaving this page. Please confirm or data will be lost';
};
This Changes worked on Firefox 46.0.1
Upvotes: 2
Views: 1484
Reputation: 6090
according to MDN's browser compatibility chart for this event, custom text support has been removed from newer versions of Chrome and Firefox. If you're using FF >= 44.0 or Chrome >= 51.0 , you'll get the default window-closing text instead of your own.
Upvotes: 4