In my HTML page I am displaying alert box many times. After few execution of alert boxes, Browser will ask
"Prevent this page from creating additional dialogs"
How can I avoid this?
Thanks.
In my HTML page I am displaying alert box many times. After few execution of alert boxes, Browser will ask
"Prevent this page from creating additional dialogs"
How can I avoid this?
Thanks.
Share Improve this question asked Jul 20, 2011 at 6:52 Royal PintoRoyal Pinto 2,9118 gold badges29 silver badges39 bronze badges 1- Why not using console.log("message") ? – ChristopheCVB Commented Jul 20, 2011 at 6:59
3 Answers
Reset to default 6Don't use alert
for regular user notifications. Instead, use jqueryUI's or your own dialog implementation, or console.log
in debugging code.
Bear in mind that modal dialog boxes tend to be user-unfriendly and should only be used in exceptional circumstances (for example, failure of AJAX munication). If you're using modal dialogs in the regular flow of an application (for example if form validation fails), consider an alternative, less intrusive notification, such as adding a red border/background to the form fields in question.
You can't. That is basically a security feature added in the browser to prevent sites from having an infinite loop making alert boxes and annoying the user.
You can't prevent this: the browser is noticing that the page keeps alerting, and assumes (often, correctly) that there is an infinite loop on the page. Preventing further alerts keeps the page usable (eg you can hit the back button).
If you are using the alerts as a way of municating important information in the normal course of operation, you might want to consider filling an element on the page with the same info. For (a very non-fancy) example, instead of
alert(x + ' just happened!');
just add a <div id="alert"></div>
to the page and do
document.getElementById('alert').innerHTML(x + ' just happened!');
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745311791a4622032.html
评论列表(0条)