Rajamohan Anguchamy
Rajamohan Anguchamy

Reputation: 1736

Return message on window.onbeforeunload custom message didn't set. it shows always default message

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 enter image description hereenter image description here

Upvotes: 2

Views: 1484

Answers (1)

Dan O
Dan O

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

Related Questions