简体   繁体   English

了解IE11 F12 Developer工具中无法访问的断点

[英]Understanding unreachable breakpoints in IE11 F12 Developer tools

I have an issue I'm trying to debug on our website, where a particular javascript routine is not being found. 我有一个问题,我正在尝试在我们的网站上调试,其中没有找到特定的JavaScript例程。 I'm at a loss to identify why, but my thinking is that if the F12 Dev tools can't reach the code for some reason, then anything in that script block is inaccessible and will not be executed. 我无法确定原因,但我的想法是,如果F12 Dev工具由于某种原因无法访问代码,那么该脚本块中的任何内容都将无法访问且无法执行。

Is there somewhere I can look to for an explanation of why code in one script block is reachable, and another, seemingly identical block is unreachable? 有什么地方我可以寻找解释为什么一个脚本块中的代码可以访问,另一个看似相同的块是无法访问的?

可达和无法访问的代码的插图

replace with language="javascript" or remove language="JavaScript" 替换为language="javascript"或删除language="JavaScript"

As per https://msdn.microsoft.com/en-us/library/ms533940(v=vs.85).aspx for attribute language. 根据https://msdn.microsoft.com/en-us/library/ms533940(v=vs.85).aspx的属性语言。

javascript JavaScript的

Script is JavaScript. 脚本是JavaScript。

Please refer this and this 请参考这个这个

Although I awarded the bounty to the first post, the actual answer is that an error in the second block of javascript invalidates the entire block for breakpoint handling. 虽然我将奖金授予了第一篇文章,但实际答案是第二个javascript块中的错误使整个块无效以进行断点处理。

To diagnose this (if the code isn't your own, or you wrote it a long time ago and have forgotten where you made changes) is to break each routine into its own separate block, then find the block that is still failing. 要诊断这个(如果代码不是您自己的,或者您很久以前编写它并且忘记了更改的位置)是将每个例程分解为它自己的单独块,然后找到仍然失败的块。 Then, go through that routine with a fine-toothed comb to determine the cause of the syntax failure -- be thorough! 然后,使用细齿梳子完成该例程,以确定语法失败的原因 - 彻底!

Once I identified the cause (a misplaced semicolon), then breakpoints were re-enabled for the entire block. 一旦我确定了原因(错误的分号),就会为整个块重新启用断点。

Other causes could be that the code block is unreachable, due to duplicate function names. 其他原因可能是由于重复的函数名称,代码块无法访问。 That wasn't my case, however, so I didn't confirm this as a possible cause of unreachable breakpoints. 然而,这不是我的情况,所以我没有证实这是可能导致无法到达的断点的原因。

It seems like the function positionCollectionList() call is returning in the end and the next block of code in your case strDGLabel_ContributingFactors hadn't been enclosed in any function so that it can't be called or executed which means it is unreachable code. 似乎函数positionCollectionList()调用最后返回,并且你的案例中的下一个代码块strDGLabel_ContributingFactors没有被包含在任何函数中,因此无法调用或执行它,这意味着它是无法访问的代码。

For making sure you can try the following example 为确保您可以尝试以下示例

Try to save the below code as a html file and open it in IE and then try to keep a breakpoint at line 8 you will reproduce the issue. 尝试将以下代码保存为html文件并在IE中打开它,然后尝试在第8行保留断点,您将重现该问题。

<html>
<script>
var te;
</script>
<script>
var test="testing";
return;
te="test";
</script>
<body>
HI
</body>
</html>

Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 IE11的F12开发人员工具缺乏使控制台保持导航的选项 - IE11's F12 developer tools lack option to keep console on navigation IE11 中的间歇性 AJAX 文件上传失败 - F12 工具无限期地显示“Pending...” - Intermittent AJAX file upload failure in IE11 - F12 tools show "Pending..." indefinitely IE11调试器(F12)中缺少图标 - Icons missing from IE11 debugger (F12) IE11 F12调试器未附加 - IE11 F12 debugger not attaching 处于仿真模式下的IE11 IE9在控制台关闭时停止Javascript执行(无F12) - IE11 in Emulation mode IE9 stopping Javascript execution while console is off (no F12) valueOf()在脚本和F12控制台中提供不同的值(仅适用于Chrome和IE11) - valueOf() gives different values in script and F12 console (Chrome and IE11 only) 右键单击和IE F12开发人员工具不适用于模式窗口 - Right-click and IE F12 Developer Tools aren't working on modal window 如何使F12开发人员工具在模拟IE版本的JavaScript上下文中运行? - How to make F12 developer tools operate in the JavaScript context of emulated IE versions? PDF嵌入不能在IE11中工作,但在DOM Explorer中编辑HTML时可以工作(F12 - IE的调试工具) - PDF embed not working in IE11, but it WORKS when edit the HTML in DOM Explorer (F12 - debug tool of IE) Internet Explorer 10 Metro中F12开发人员工具的替代方案? - Alternatives to F12 Developer tools in Internet Explorer 10 Metro?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM