Google chrome not displaying alert() popups for one site

96,104

Solution 1

You don't need to restart the browser. Just close the tab and reopen it again. It does not need to be Incognito.

Solution 2

Not tested but if you have the problem again I think opening the site in an incognito window will reset the dialogs.

Edit: I added this answer which worked for the Chrome build as it was. Updates might have rendered this unnecessary (appreciate not to be marked down!)

Solution 3

Restart the browser, that should reset that option and show you new dialog boxes.

Solution 4

FROM THE OP:

The solution was to restart the browser. Lose all my tabs? No!!!

However, there's a way to restart your browser and not lose all your tabs.

Install the Session Manager add-on. There is a version of Session Manager for both Chrome and for Firefox.

Session Manager maintains a running list of your open tabs and will automatically ask you if you want to re-open them ("recover your session") after an unexpected reboot or system crash.

Additionally, Session Manager will let you save your tabs on demand and reload them at a later time, or after a reboot. You can save your "session" (all open tabs) any time you want, and give the session whatever name you want.

Finally, when reloading a previous session, you can also choose which tabs to re-open and which tabs to ignore.

Can't live without it, in either Chrome or Firefox.

Chrome extension

Firefox extension

And if you are using IE . . . well, you have other problems.

Solution 5

If you want to detect if these are being blocked. You will have to do your own thing with the message you will be dispalying but override the native alert/confirm.

window.nativeAlert = window.alert;
window.alert = function (message) {
var timeBefore = new Date();
var confirmBool = nativeAlert(message);
var timeAfter = new Date();
if ((timeAfter - timeBefore) < 350) {
    MySpecialDialog("You have alerts turned off, turn them back on or die!!!");
  }
}

window.nativeConfirm = window.confirm;
window.confirm = function (message) {
var timeBefore = new Date();
var confirmBool = nativeConfirm(message);
var timeAfter = new Date();
if ((timeAfter - timeBefore) < 350) {
    MySpecialDialog("You have alerts turned off, turn them back on or die!!!");
}
 return confirmBool;
}

Obviously I have set the time to 3.5 milliseconds. But after some testing we were only able to click or close the dialogs in about 5 milliseconds plus

Share:
96,104

Related videos on Youtube

cssyphus
Author by

cssyphus

Props to CertainPerformance for his StackOverflow TamperMonkey scripts. Muchos gracias, compadre! Anyone not already familiar with TamperMonkey: this is a Must-Have browser extension. Quick intro: see this and this. Some useful TamperMonkey repos: LegacyProfiles by Spectric Some site-specific userscripts A couple of not-to-miss personal favs: Rob Latour's Apps - SetVol is particularly useful Nenad Hrg's Apps When reading posts/answers, I am not asking you to upvote. But if you do, please do not upvote more than 2 on the same day (otherwise, your upvotes will be removed by the StackOverflow anti-cheating system, which I whole-heartedly support). Sharing the information is the important thing. How to use the &lt;svg&gt; viewBox attribute? When is localStorage cleared? css calc invalid property value Change highlight text color in Visual Studio Code

Updated on December 04, 2020

Comments

  • cssyphus
    cssyphus over 3 years

    I was working on a javascript loop that alerted each key value as the loop progressed.

    To speed things along, I checked the box "Prevent this page from creating additional dialogs". Usually this only suppresses popups for the one routine, but they haven't come back.

    In Google Chrome, alert() messages no longer pop up from that site. Other sites do, but not that site.

    Has anyone heard of this before?

    Q: How can I reset the alert() messages for that site?

    • bfavaretto
      bfavaretto over 10 years
      Maybe Chrome is doing you a favor: forget alert and start using the console!
    • epascarello
      epascarello over 10 years
      this is a supoer user type of question, but look at the pop up manager support.google.com/chrome/answer/95472?hl=en-GB
    • cssyphus
      cssyphus over 10 years
      @Adam You might be right. I've got so many tabs open I was trying everything to avoid that. Please post this idea as an answer so I can accept if it works.
    • aequalsb
      aequalsb about 9 years
      i recommend the solution from chharvey below as the most elegant solution (close the tab then reopen it)
  • cssyphus
    cssyphus over 10 years
    You are absolutely right! Much better solution than bouncing the browser. Thanks.
  • Rocco
    Rocco over 9 years
    opening a new tab or window works for me as of Chrome 39 - does not have to be incognito
  • aequalsb
    aequalsb about 9 years
    i confirm this works and consider it the most elegant solution, thank you.
  • chharvey
    chharvey about 9 years
    @Rocco—agreed. see my answer.
  • Sean Kendle
    Sean Kendle about 9 years
    What's the logic behind this? I get what each line does, but why does this "discover" if the alert is suppressed?
  • DeadlyChambers
    DeadlyChambers about 9 years
    We are using frames (yuck) and the user was able to turn them off on one page and then not see them anywhere else. This is a problem because some validation is dependent on the confirm callback (yuck again). The returned value is false when the confirms are blocked. Even worse the confirm doesn't show. So the user submits and has no idea why the page doesn't do anything. Workaround for poor design, trust me I hate it but a legacy app that is massive. The workaround saved us a ton of time.
  • Sean Kendle
    Sean Kendle about 9 years
    Thanks for that explanation, but my question wasn't about the necessity to check for alert suppression, but why that code works to tell you that it's been suppressed. I'm not understanding why 3.5 milliseconds later it's clear that the alert was suppressed. Who can click an alert in 3.5 milliseconds? I'm confused.
  • Sean Kendle
    Sean Kendle about 9 years
    Also: The "or die" phrase - is that a PHP inside joke? Haha!
  • DeadlyChambers
    DeadlyChambers about 9 years
    Oh, well it works for that very reason. Nobody could possibly click the ok/cancel button in 3.5 milliseconds. Unless they got it by hitting return and didn't remove the finger from the key. I got the idea from firefox which was checking if two alerts were opened within a second of each other then the checkbox is displayed. Anyways when a native popup is opened in the browser operations are halted until the dialog is resolved (closed or buttons are hit). Since the browser doesn't display a dialog it runs through these functions almost immediately. I hope this makes a little bit more sense.
  • DeadlyChambers
    DeadlyChambers about 9 years
    @SeanKendle I like to strike fear into the heart's of my users, I have found that death threats work pretty well.
  • Hoàng Long
    Hoàng Long about 8 years
    @KjetilNordin: I think it has something to do with cookie/session. Incognito mode doesn't maintain your cookie. Of course a guy at Google read this answer and fix the problem.
  • Guruprasad J Rao
    Guruprasad J Rao about 8 years
    I don't think you need extensions for this, because the browser itself will have properties to set as in On startup you can choose to continue where you left off and you can find this in browser settings...
  • Karthick Ramesh
    Karthick Ramesh over 4 years
    Welcome to SO. Please avoid adding comments in answers section