Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Team

this is my code but not support in firefox
var myEvent = window.attachEvent || window.addEventListener;
var chkevent = (window.attachEvent) ?onbeforeunload : beforeunload;
myEvent(chkevent, function(e) { // For >=IE7, Chrome, Firefox
window.onbeforeunload = null;
var confirmationMessage = 'Rajeev Rahi'; // a space
(e || window.event).returnValue = confirmationMessage ;
return confirmationMessage ;
});
Rajeev Rahi is showing when i refresh on chrom but not work in firefox
Actually i want change in refresh pop-up.
Posted

1 solution

You can't. I ran into this problem yesterday, and it turns out it's a "security feature":
Bug 588292 - Remove site-supplied text for beforeunload and onunload dialogs, and improve button text [^]

Quite why Mozilla think it's a security problem, when every other browser supports it, I don't know.

The only workaround is to display a message in the "click" event of every element which would cause the page to unload. It's messy and fragile, but it's the only way to display a custom message.
 
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