I want to know whether there is any browser variable that stores the number of alert boxes created by a web page. There should be counter which counts the number of alert boxes as the browser displays option to prevent creating additional dialog boxes when an alert box is triggered more than once. I want to reset that counter so that the option does appear. So is there any way to clear that counter using JavaScript.
Asked
Active
Viewed 1,430 times
0
-
Duplicates: [Why “Prevent this page from creating additional dialogs” appears in the alert box?](http://stackoverflow.com/questions/5848381/why-prevent-this-page-from-creating-additional-dialogs-appears-in-the-alert-bo?lq=1) and [Turn Off - prevent this page from creating additional dialogs](http://stackoverflow.com/questions/11823613/turn-off-prevent-this-page-from-creating-additional-dialogs?rq=1) and more... – Yogi Apr 19 '16 at 10:28
-
There is no _Browser variable_ but you can maintain your own.... – Rayon Apr 19 '16 at 10:34
2 Answers
2
The mechanism to prevent alert boxes exist because of misuse of the alert functionality. It is a browser thing, not a JavaScript thing.
In short: You can't, and should not be able to, reset the counter. Instead you should use another way of alerting your audience.
For the counting:
You can add your own counter
alertCounter = 0;
myAlert(msg){
alertCounter++;
alert(msg);
}
From here you just use the myAlert(...)
function instead.

Mads Buch
- 344
- 2
- 10
2
You can't.
But you can use JQuery UI dialog widget, they are not covered by the browsers, so no "disable"-option will appear.
Credit to this Answer