如何在Chrome开发者工具中搜索所有加载的脚本?
在 Firebug 中,您可以搜索一些文本,它会在页面上加载的所有脚本中查找它。在调试客户端脚本时,可以在 Chrome 开发者工具中完成同样的操作吗?我尝试过,但它似乎只在我打开的脚本中搜索,而不是页面上的其余部分。
我希望接下来的屏幕截图能够更好地了解我想要完成的任务:
以下屏幕截图来自 Firebug 中的单个搜索:
In Firebug, you can search some text and it will look for it in all scripts loaded on a page. Can the same be done in Chrome Developer tools while debugging client script? I tried it, but it seems to search only in the script I have open, and not the rest that are on the page.
I hope the next screenshots give a better idea about what I'm trying to accomplish:
The following screenshots are from a single search in Firebug:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
在开发者工具中打开一个新的搜索窗格,方法是:
您可以在支持正则表达式和区分大小写的所有脚本中进行搜索。
单击任何匹配项以在脚本面板中加载该文件/部分。
确保在 DevTools 首选项中选中“在匿名和内容脚本中搜索”(F1 )。这将从 iframe 和 HTML 内联脚本中返回结果:
Open a new Search pane in Developer Tools by:
You can search across all your scripts with support for regular expressions and case sensitivity.
Click any match to load that file/section in the scripts panel.
Make sure 'Search in anonymous and content scripts' is checked in the DevTools Preferences (F1). This will return results from within iframes and HTML inline scripts:
使用 Control+Shift+F 或 Console->[搜索选项卡] 搜索所有文件
注意:全局搜索显示在控制台菜单旁边
Search All Files with Control+Shift+F or Console->[Search tab]
NOTE: Global Search shows up next to the CONSOLE menu
除了 Ctrl+Shift+F (Cmd+Option+F(在 Mac 上))按照此答案中的建议,您可以右键单击源选项卡并选择“在所有文件中搜索”:
In addition to Ctrl+Shift+F (Cmd+Option+F on Mac) as suggested in this answer, you can right click on the top tree node in the sources tab and select "Search in All Files":
在 Windows 中 Control+Shift+F。还要确保在内容脚本中进行搜索。转到设置->来源->在匿名和内容脚本中搜索。
In Windows Control+Shift+F. Also make sure to search in content scripts as well. Go to Settings->Sources-> Search in anonymous and content script.
在截至 2018 年 10 月 26 日的最新 Chrome 中,评分最高的答案不再有效,具体做法如下:
In the latest Chrome as of 10/26/2018, the top-rated answer no longer works, here's how it's done:
在《寡妇》中,它对我有用。控制 Shift F,然后在底部打开一个搜索窗口。确保展开底部区域以查看新的搜索窗口。
In Widows it is working for me. Control Shift F and then it opens a search window at the bottom. Make sure you expand the bottom area to see the new search window.
您的文本可能位于网络响应中。“网络”选项卡中还有一个搜索工具,您可以尝试一下。
您要搜索的内容可能保留在 DOM 中,也可能保留在内存中。如果它不在 DOM 中,那么它可能在内存中,因为无论如何您刚刚在计算机屏幕上看到了它。
您搜索的文本可以从初始 DOM 中的脚本加载,也可以从后续请求中的响应加载。
Your text may be located in the networking response.There is also a search tool in the Network tab, and you may try it.
What you want to search for may stay either in DOM or in memory. If it is not in DOM, well, it may be in memory, because you have just see it in your computer screen anyway.
The text you search for may be loaded either from scripts in the initial DOM or from response in the later request.