Atul  Prajapati
Atul Prajapati

Reputation: 177

Is there any way to show the custom message when exiting from the firefox browser

I want the script which can display the custom message to the user when it exits from the page in the firefox browser. Firefox is showing its default message even after using custom message, though chrome is showing it correctly. But i want to display this custom message in firefox also

 window.onbeforeunload = function() {

   return 'Are you sure.';
 }

Upvotes: 0

Views: 502

Answers (1)

DasBeasto
DasBeasto

Reputation: 2282

It appears they disabled it on purpose: https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload

In Firefox 4 and later the returned string is not displayed to the user. Instead, Firefox displays the string "This page is asking you to confirm that you want to leave - data you have entered may not be saved."

See this related question for potential workarounds, but all are pretty messy:

Firefox 4 onBeforeUnload custom message

Upvotes: 2

Related Questions