如何在Chrome开发者工具中搜索所有加载的脚本?

发布于 2024-10-01 09:41:38 字数 354 浏览 2 评论 0原文

在 Firebug 中,您可以搜索一些文本,它会在页面上加载的所有脚本中查找它。在调试客户端脚本时,可以在 Chrome 开发者工具中完成同样的操作吗?我尝试过,但它似乎只在我打开的脚本中搜索,而不是页面上的其余部分。

我希望接下来的屏幕截图能够更好地了解我想要完成的任务: alt text

以下屏幕截图来自 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:
alt text

The following screenshots are from a single search in Firebug:
alt text
alt text

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

泪痕残 2024-10-08 09:41:39

在开发者工具中打开一个新的搜索窗格,方法是:

  • Ctrl+Shift+F (Cmd+ Option+I(在 Mac 上)
  • 单击 DevTools 中的溢出菜单 (),DevTools 溢出菜单
  • 单击控制台中的溢出菜单 ()并选择“搜索”选项

您可以在支持正则表达式和区分大小写的所有脚本中进行搜索。

单击任何匹配项以在脚本面板中加载该文件/部分。

搜索所有文件 - 结果

确保在 DevTools 首选项中选中“在匿名和内容脚本中搜索”(F1 )。这将从 iframe 和 HTML 内联脚本中返回结果:

在匿名和内容脚本中搜索 DevTools 设置首选项

Open a new Search pane in Developer Tools by:

  • pressing Ctrl+Shift+F (Cmd+Option+I on mac)
  • clicking the overflow menu () in DevTools, DevTools overflow menu
  • clicking the overflow menu in the Console () and choosing the Search option

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.

Search all files - results

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:

Search in anonymous and content scripts DevTools Settings Preferences

迷雾森÷林ヴ 2024-10-08 09:41:39

使用 Control+Shift+F 或 Console->[搜索选项卡] 搜索所有文件

在此处输入图像描述

注意:全局搜索显示在控制台菜单旁边

Search All Files with Control+Shift+F or Console->[Search tab]

enter image description here

NOTE: Global Search shows up next to the CONSOLE menu

浪推晚风 2024-10-08 09:41:39

除了 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":

enter image description here

北城挽邺 2024-10-08 09:41:39

在 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.

离不开的别离 2024-10-08 09:41:39

在截至 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:
enter image description here

enter image description here

記憶穿過時間隧道 2024-10-08 09:41:39

在《寡妇》中,它对我有用。控制 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.

enter image description here

我一直都在从未离去 2024-10-08 09:41:39

您的文本可能位于网络响应中。“网络”选项卡中还有一个搜索工具,您可以尝试一下。

您要搜索的内容可能保留在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文