如何防止Google Chrome禁止对话框? [英] How to prevent Google Chrome suppressing dialogs?

查看:1099
本文介绍了如何防止Google Chrome禁止对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何防止Chrome控制台在尝试使用prompt()命令时发出以下错误?

How can I prevent Chrome console giving the following error when I try to use the prompt() command?


window.prompt ()由此页面生成的对话框被取消,因为
此页面不是前窗口的活动选项卡。请确保
对话由用户交互触发,以避免
的情况。 https://www.chromestatus.com/feature/5637107137642496

直到2-3天前,prompt()命令工作正常,并会打开一个对话框,我可以输入数据,现在它总是会给我这个错误,即使我我绝对在活动标签上。我检查了Chrome内容设置并允许弹出窗口被选中。

Up until 2-3 days ago the prompt() command worked fine and would open a dialog where I could input data, now it always gives me this error even if I am definitely on the active tab. I have checked chrome content settings and allow popups is checked.

谢谢!

Thanks!

推荐答案

这里的错误行为是因为,在使用开发人员工具进行调试时,开发人员工具窗口实际上是活动窗口。解决方法是使用在实际调试的选项卡上呈现的播放按钮或步骤按钮,如下所示。

The buggy behaviour here is because, when debugging using the developer tools, the developer tools window is actually the active one. A workaround is to use the play or step buttons that render over the tab that is actually being debugged, as shown below.

这篇关于如何防止Google Chrome禁止对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆