Javascript 关闭 - “防止此页面创建其他对话框”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11823613/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Turn Off - “prevent this page from creating additional dialogs”
提问by Karthick V
How do I turn off the Firefox feature “prevent this page from creating additional dialogs”?
如何关闭 Firefox 功能“阻止此页面创建其他对话框”?
I get this problem, when I open more than one confirm box(dialog).
当我打开多个确认框(对话框)时,我遇到了这个问题。
Is it possible to prevent this feature via Javascript?
是否可以通过 Javascript 阻止此功能?
回答by epoch
This is a browser feature and is intended to protect the user. If you could turn it off, all those sites spamming users with dialogs would have a way to stop it.
这是浏览器的一项功能,旨在保护用户。如果您可以将其关闭,那么所有通过对话框向用户发送垃圾邮件的站点都将有办法阻止它。
So in short, no.
简而言之,没有。
Make your application work with it, instead of against it. Don't rely on dialogs/confirmations too much, rather have a modal-box
ask the questions; it is pretty too :)
让您的应用程序使用它,而不是反对它。不要过分依赖对话/确认,而要modal-box
提出问题;它也很漂亮:)
回答by Ariel
Open about:config
then change the pref dom.successive_dialog_time_limit
打开about:config
然后更改首选项dom.successive_dialog_time_limit
Of course this only works for your own browser, you can't change it for other people.
当然,这只适用于您自己的浏览器,您不能为其他人更改它。
回答by Kobi
To my knowledge, there is no way to disable it. Alert boxes are obtrusive, and at least in Firefox - can steal focus even from other tabs.
据我所知,没有办法禁用它。警报框很突兀,至少在 Firefox 中 - 甚至可以从其他选项卡中窃取焦点。
A simple workaround is to use an HTML based modal dialog- this will also give you full control over the dialog, its design (across browsers and operating systems), its buttons, behavior of the rest of the page, etc.
一个简单的解决方法是使用基于 HTML 的模态对话框- 这还可以让您完全控制对话框、它的设计(跨浏览器和操作系统)、它的按钮、页面其余部分的行为等。
回答by user2406101
Finally the issue is solved :) , developer need some attention before calling any alert or confirm messages in chrome or firefox. The alert or confirm box will display 1.5 sec delay.
终于问题解决了 :) ,开发人员在调用 chrome 或 firefox 中的任何警报或确认消息之前需要注意一些。警报或确认框将显示 1.5 秒延迟。
function chromeTimeDelay(){
if (navigator.userAgent.indexOf("Chrome") > 0){
var d =e = new Date();
while(d.getTime()<(e.getTime()+1500)){
d = new Date();
}
}
}
function dontdisplaycheckbox(){
for(var i=0;i<=10;i++){
chromeTimeDelay();
alert("abcdefgh");
}
}