Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Web 应用程序中,所有页面都使用 ajax 加载。有些页面有自己的 js 文件,这些文件是在添加新页面后加载的。我想调试添加的动态 js,但在 chrome 的调试器中我找不到那个 js 文件。
如何找到该文件进行调试?
您只需在代码中添加以下内容 -
debugger;
保持脚本控制台打开。当遇到此行时,调试器将在此时等待,直到您进一步操作。
注意:您的脚本控制台应该已经打开,因为您无法实际选择要调试的脚本文件。在运行时,chrome 会program.js用动态渲染的 js 创建一个动态文件。
program.js