为什么 IE7 有 window.prompt 时会询问我的批准(用户)?
我的代码中有一个 window.prompt,它应该停止代码流,直到用户输入一些值。
当然,IE7 试图保护我免受我自己的伤害,它不显示提示,而是显示安全选项卡(在页面顶部,警告用户脚本想要打开一个窗口)。
更糟糕的是,提示被忽略,其余流程正在完成。不管怎样,这不起作用,因为脚本缺少用户的数据。
我应该怎样做才能避免该安全栏,因为该脚本是页面/域的一部分。
I have in my code a window.prompt, which should stop the flow of the code until user put in some value.
Of course IE7 try to protect me from myself and instead of showing the prompt it shows the security tab (top of the page where it alerts to the users that a script wants to open a window).
What is even worse is that the prompt is ignore and the rest of the flow is being done. Regardless to say this can't work as the script is missing data from the user.
What should I do to avoid that security bar, as this script is part of the page/domain.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于这个原因,
window.prompt()
在一般网络上不再可用,因为无法绕过脚本中的安全横幅。您必须使用其他一些机制,例如模拟模式对话框的许多 JavaScript UI 组件中的任何一个。window.prompt()
is no longer usable on the general web for this very reason, since there's no way to get round the security banner in your script. You'll have to use some other mechanism, like any of the many JavaScript UI components that emulate modal dialogs.