0

Localhost development throwing security_manager_veto errors during certain interactions with the beforeunload event.

The default "leave the page" warning shows up and pressing cancel and then refresh or just refresh while the dialog was open kept throwing the error.

Mozilla's suggestion for preventing the popup

window.addEventListener("beforeunload", function (e) {
    var confirmationMessage = false;

     e.returnValue = confirmationMessage;     // Gecko, Trident, Chrome 34+
    return confirmationMessage;              // Gecko, WebKit, Chrome <34
 });

Was ineffective.

EDIT

Problem was due to jquery handling beforeunload events in the background.

Using the answers on another SO question here and unbinding the onbeforeunload using jquery, the problem was fixed.

Community
  • 1
  • 1
user2782001
  • 3,380
  • 3
  • 22
  • 41
  • What are you trying to do with that? There's no default action of `beforeunload` to prevent. – Barmar May 26 '16 at 19:29
  • It's the "The page is asking you to leave dialog..". It's being replaced with one that has more detailed options. Mozillas docs say unloading can be done 'silently' as far as the web browser is concerned, but it just won't go away. Other developer is using jquery though. Maybe it puts a returnValue on the beforeunload event... (also this is for a very specific small walled portal, so we are ignoring general public UI practices on purpose) – user2782001 May 26 '16 at 19:47
  • You're not supposed to be able to prevent that dialog. Malware used to do that to prevent you from leaving their web site, and browsers were changed to prohibit it. – Barmar May 26 '16 at 19:54
  • Hmm.. Mozillas docs read differently https://developer.mozilla.org/en-US/docs/Web/Events/beforeunload – user2782001 May 26 '16 at 19:59
  • Yes, it can be done silently, but you can't prevent the unload. If you want it to be silent, just return `undefined`. – Barmar May 26 '16 at 20:01

0 Answers0