I"m developing a web app that utilises JavaScript alert() and confirm() dialogue boxes.

You are watching: Prevent this page from creating additional dialogs

How can I stop Chrome from showing this checkbox?

*

Is there a setting I can modify?

I know I could modify the source code, but I"d like it so that Chrome could still auto-update.

I don"t need to worry about other browsers since the app only runs in Chrome.

I have admin access to the (Windows) machines that run the app.


*

You can"t. It"s a browser feature there to prevent sites from showing hundreds of alerts to prevent you from leaving.

You can, however, look into modal popups like jQuery UI Dialog. These are javascript alert boxes that show a custom dialog. They don"t use the default alert() function and therefore, bypass the issue you"re running into completely.

I"ve found that an apps that has a lot of message boxes and confirms has a much better user experience if you use custom dialogs instead of the default alerts and confirms.


*

*

This is what I ended up doing, since we have a web app that has multiple users that are not under our control...(
DannyBeckett I know this isn"t an exact answer to your question, but the people that are looking at your question might be helped by this.) You can at least detect if they are not seeing the dialogs. There are few things you most likely want to change like the time to display, or what you are actually displaying. Remember this will only notify the user that they are have managed to click that little checkbox.

window.nativeAlert = window.alert;window.alert = function (message) { var timeBefore = new Date(); var confirmBool = nativeAlert(message); var timeAfter = new Date(); if ((timeAfter - timeBefore) 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.

See more: Asi En La Tierra Como En El Infierno (Subtitulada), Así En La Tierra Como En El Infierno


*

I know everybody is ethically against this, but I understand there are reasons of practical joking where this is desired. I think Chrome took a solid stance on this by enforcing a mandatory one second separation time between alert messages. This gives the visitor just enough time to close the page or refresh if they"re stuck on an annoying prank site.

So to answer your question, it"s all a matter of timing. If you alert more than once per second, Chrome will create that checkbox. Here"s a simple example of a workaround:

var countdown = 99;function annoy() if(countdown>0) alert(countdown+" bottles of beer on the wall, "+countdown+" bottles of beer! Take one down, pass it around, "+(countdown-1)+" bottles of beer on the wall!"); countdown--; // Time must always be 1000 milliseconds, 999 or less causes the checkbox to appear setTimeout(function() annoy(); , 1000); // Don"t alert right away or Chrome will catch yousetTimeout(function() annoy();, 1000);