为什么“阻止此页面创建其他对话框”出现在警告框中?
在我的 Rails 3 应用程序中,我这样做:
render :js => "alert(\"Error!\\nEmpty message sent.\");" if ...
有时,在此错误消息下方(在同一个警报框中)我会看到:“阻止此页面创建其他对话框”和一个复选框。
这是什么意思?
是否可以不显示此附加文本和复选框?
我使用火狐4。
In my Rails 3 application I do:
render :js => "alert(\"Error!\\nEmpty message sent.\");" if ...
Sometimes, below this error message (in the same alert box) I see: "Prevent this page from creating additional dialogs" and a checkbox.
What does this mean ?
Is that possible not to display this additional text and checkbox ?
I use Firefox 4.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
这是一项浏览器功能,可阻止反复显示烦人的警报框的网站。
作为网络开发人员,您无法禁用它。
It's a browser feature to stop websites that show annoying alert boxes over and over again.
As a web developer, you can't disable it.
这是浏览器端的一项安全措施,通过在无限循环中显示模式(警报/确认)消息来防止页面冻结浏览器(或当前页面)。对于 Firefox,请参阅此处。
您无法将其关闭。解决这个问题的唯一方法是使用自定义对话框,例如 JQuery UI 对话框。
This is a security measure on the browser's end to prevent a page from freezing the browser (or the current page) by showing modal (alert / confirm) messages in an infinite loop. See e.g. here for Firefox.
You can not turn this off. The only way around it is to use custom dialogs like JQuery UI's dialogs.
您可以使用java脚本创建自定义警报框,下面的代码将覆盖默认警报功能
You can create a custom alert box using java script, below code will override default alert function
这是浏览器的功能。
该库执行相同的操作
如果可以的话,尝试使用 http://bootboxjs.com/,您可以通过 写作:
您还将获得一个漂亮的用户界面!
This is a browser feature.
If you could, try to employ http://bootboxjs.com/, whit this library you can do the same of
by writing:
You'll get a nice user interface too!
使用 JQuery UI 对话框并不总是解决方案。据我所知,警报和确认是在某个点停止执行脚本的唯一方法。作为一种解决方法,我们可以提供一种机制来让用户知道应用程序需要调用警报并确认。例如,可以这样完成(其中 showError 使用 jQuery 对话框或其他方式与用户通信):
Using JQuery UI's dialogs is not always a solution. As far as I know alert and confirm is the only way to stop the execution of a script at a certain point. As a workaround we can provide a mechanism to let the user know that an application needs to call alert and confirm. This can be done like this for example (where showError uses a jQuery dialog or some other means to communicate with the user):
我设计这个函数是为了希望绕过我的网络应用程序中的复选框。
它在执行时阻止页面上的所有功能(假设自用户关闭最后一个对话框以来已经过去了不到三秒),但我更喜欢它而不是递归或 setTimeout 函数,因为我不必为其他可能性编写代码在等待对话框出现时被单击或触发。
在 Modalbox 中已包含的报告上显示错误/提示/确认时,我最需要它。我可以为其他对话框添加一个 div,但如果可以使用内置对话框,这似乎太混乱且不必要。
请注意,如果 dom.successive_dialog_time_limit 更改为大于 3 的值,这可能会中断,我也不知道 Chrome 是否具有与 Firefox 相同的默认值。但至少这是一个选择。
另外,如果有人可以改进它,请这样做!
用法:
I designed this function to hopefully circumvent the checkbox in my web apps.
It blocks all functionality on the page while executing (assuming fewer than three seconds has passed since the user closed the last dialog), but I prefer it to a recursive or setTimeout function since I don't have to code for the possibility of something else being clicked or triggered while waiting for the dialog to appear.
I require it most when displaying errors/prompts/confirms on reports that are already contained within Modalbox. I could add a div for additional dialogs, but that just seems too messy and unnecessary if built-in dialogs can be used.
Note that this would probably break if dom.successive_dialog_time_limit is changed to a value greater than 3, nor do I know if Chrome has the the same default as Firefox. But at least it's an option.
Also, if anyone can improve upon it, please do!
usage: