如何在IE Developer Tools中为加载时运行的代码创建断点? [英] How do you create breakpoints in IE Developer Tools for code that runs while loading?
问题描述
所以我有这个网页我需要在IE(9)调试。我想使用开发工具。我需要在页面加载时运行的代码中创建一个断点。
So I have this web page I need to debug in IE (9). I'd like to use the Developer Tools. I need to create a breakpoint inside code that runs while the page is loading.
问题是即使我设置了断点,当我重新加载页面时,它将是擦除,因为这是一个新的上下文。
The problem is that even if I set a breakpoint, when I reload the page it will be erased, as this is a new context.
如果所述代码只在一些给定的操作后运行,我可以创建断点,然后才触发该操作。但是它运行时加载,所以没有运气。
If said code only ran after some given action, I could create the breakpoint and only trigger the action afterwards. But it runs while loading, so no luck.
调试器;
语句可以做我想要的,但它触发VS调试与...对话框,其中唯一的选项是VS。
The debugger;
statement could do what I want, but it triggers the VS Debug with... dialog, in which the only option is VS.
谢谢。
推荐答案
我已经做了很多,这里是我遵循的程序:
I've been doing this for quite a bit, here is the procedure I follow:
- 将您的
调试器;
行,无论您需要它在
JavaScript代码中。 - 打开IE和 BEFORE 加载您的页面,然后按F12键
启动工具 - 在开发工具中,单击脚本选项卡,然后按
开始
按钮。这将使开发工具知道您指定的任何
调试
断点。 - 加载您的网页,开发工具应该选择
调试器语句。 li>
- Put your
debugger;
line wherever you need it to be in your javascript code. - Open up IE and BEFORE loading your page and press F12 to bring up the Dev Tools
- In the Dev Tools, click on the Script tab and press the
Start Debugging
button. This will make the Dev tools aware of any breakpoints you have specified. - Load up your webpage and the Dev Tool should pick up the debugger statement.
祝你好运!
这篇关于如何在IE Developer Tools中为加载时运行的代码创建断点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!