我可以在 Internet Explorer 11 的调试器中修改 Javascript 代码吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29946761/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can I modify Javascript code in Internet Explorer 11's debugger?
提问by John 'Mark' Smith
In IE11 I can right click on a webpage and call the "Inspect Element" tool. This allows me to modify HTML/CSS dynamically and is extremely useful.
在 IE11 中,我可以右键单击网页并调用“检查元素”工具。这允许我动态修改 HTML/CSS 并且非常有用。


I can choose "Edit as HTML" and do whatever I want without having to reload the page.
我可以选择“编辑为 HTML”并做任何我想做的事情而无需重新加载页面。


What I want is to be able to do the same in IE 11's Javascript debugger. I want to modify a script in the browser so that I do not have to reload the page entirely. The page I am working on takes 20-40seconds to load when I run it locally, meaning it takes about a minute to implement even the smallest changes in my file.js.
我想要的是能够在 IE 11 的 Javascript 调试器中做同样的事情。我想修改浏览器中的脚本,这样我就不必完全重新加载页面。当我在本地运行时,我正在处理的页面需要 20-40 秒才能加载,这意味着即使在我的 file.js 中实现最小的更改也需要大约一分钟。
Can this be done?
这能做到吗?
采纳答案by Coretool
If the JS code is embed into the HTML it should work without any problems but if it's stored I an other file you probably can't edit it in the browser. I recommend using Firefox or chrome. Both have got an inbuilt and very useful editors which can edit HTML as well as Js and CSS .
如果 JS 代码嵌入到 HTML 中,它应该可以正常工作,但如果它存储在其他文件中,您可能无法在浏览器中编辑它。我建议使用 Firefox 或 chrome。两者都有一个内置且非常有用的编辑器,可以编辑 HTML 以及 Js 和 CSS。
回答by BK1NG
I know this is an older post but this might help someone else.
我知道这是一篇较旧的帖子,但这可能对其他人有所帮助。
"I just loaded up my website in Chrome and whilst I can edit the Javascript file (you can definitely edit Javascript when it is in a .html page) but I cannot get the changes I have made in the .js file to actually function."
“我刚刚在 Chrome 中加载了我的网站,虽然我可以编辑 Javascript 文件(当它在 .html 页面中时,你绝对可以编辑 Javascript),但我无法使我在 .js 文件中所做的更改实际运行。 ”
If you set a breakpoint at the top of the .js file and refresh, you can edit the code that comes after the break point and chrome will load your new changes. Note that your changes will be wiped out after every refresh, but it will hit your breakpoint and allow you to add them again.
如果您在 .js 文件顶部设置断点并刷新,您可以编辑断点之后的代码,chrome 将加载您的新更改。请注意,每次刷新后您的更改都会被清除,但它会到达您的断点并允许您再次添加它们。

