在 IE 中调试模式对话框 (showModalDialog)
我想调试(检查 DOM、使用交互式 JS 控制台等)Web 应用程序的一部分,该应用程序位于由 showModalDialog()
创建的模式对话框内。
我找不到使用标准 IE-8 开发人员工具来实现此目的的方法;该对话框没有工具栏,并且常用的快捷键 (F12) 不起作用。
另一个SO问题(不幸的是我失去了链接)建议唯一的解决方案是(也许暂时)用老式的window.open()
替换showModalDialog()
>。如果是这种情况,有没有一种简单的方法可以做到这一点?
注意事项:
- 应用程序关心传递dialogArguments和showModalDialog的返回值
- 我不能使用其他浏览器,FF+Firebug等。
I want to debug (examine DOM, use the interactive JS console, etc) part of a web application that is inside a modal dialog that was created by showModalDialog()
.
I can't find a way to use the standard IE-8 developer tools for this; The dialog doesn't have a toolbar and the usual shortcut (F12) doesn't work.
Another SO question (I unfortunately have lost the link to) suggested that the only solution is to (perhaps temporarily) replace showModalDialog()
with an old-fashioned window.open()
. If this is the case, is there a straightfoward way to do it?
Caveats:
- The app cares about passing dialogArguments and the return value of showModalDialog
- I can't use other browsers, FF+Firebug, etc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您打开地址栏,F12 可以调出开发人员工具。
来源:https://stackoverflow.com/a/10984858/79835< /a>
F12 works to bring up the developer tools if you turn the address bar on.
Source: https://stackoverflow.com/a/10984858/79835
我通过在 js 代码中创建一个错误来实现这一点,然后弹出错误窗口,询问您是否要调试脚本。
一种方法是在代码中的某个位置调用不存在的方法。
例如
布拉布拉();
i do it by creating an error in the js code, which then brings up the error window asking if you want to debug the script.
one way to do that would be to call a non-existent method somewhere in the code.
e.g.
blabla();
现在,您可以在 javascript 中添加不带引号的
debugger
一词。IE 和 Chrome 都应该在其上中断,就像您在其上设置了断点一样。确保它自己在一条线上。按 F12 打开浏览器调试器,然后刷新页面或触发事件来运行 JavaScript,调试器应自动显示设置了断点的代码。
You can now put the word
debugger
without quotes in your javascript.IE and Chrome should both break on it as if you had set a breakpoint on it. Make sure its on a line by itself. Press F12 to open the browser debugger and then refresh your page or trigger the event to run your javascript and the debugger should automatically display the code with the breakpoint set.
当我调试模态窗口时我会做两件事。
希望有帮助!
What I do when i'm debugging modal windows are two things.
Hope it helps!