javascript 我可以使用 chrome-devtools 来实际搜索所有 JS 源吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15944633/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 02:41:54  来源:igfitidea点击:

Can I get chrome-devtools to actually search all JS sources?

javascriptgoogle-chrome-devtools

提问by David McMullin

I'm having trouble with searching through JS files in chrome dev-tools, in the past the search activated by Ctrl+Shift+Falways found what I wanted, but recently (I'm not sure exactly which update triggered this) I'm finding the search does not catch

我在与Chrome浏览器开发的工具,通过JS文件搜索,麻烦了过去由活化的搜索Ctrl+ Shift+F总是能找到我想要的东西,但最近(我不知道到底是哪更新触发这个)我发现了搜索未捕获

  • JS in inline script tags

  • JS inside iframes.

  • 内联脚本标签中的 JS

  • iframe 中的 JS。

I've also found the callstack messed up when inline scripts were involved, but when I try to google for these issues, I just get the dev-tools doc pages, has anyone else noticed these issues? Was I just imagining this worked before?

我还发现当涉及内联脚本时调用堆栈搞砸了,但是当我尝试用谷歌搜索这些问题时,我只得到了开发工具的文档页面,有没有其他人注意到这些问题?我之前只是想象这有效吗?

采纳答案by David McMullin

It seems the answer is always easier to find after you've taken the time to phrase the question properly...

在您花时间正确表达问题之后,似乎总是更容易找到答案......

I found an option under General -> Sources called "Search in content scripts". I'm not sure how/when I disabled this but enabling it and restarting chrome has fixed all of my problems.

我在 General -> Sources 下找到了一个名为“Search in content scripts”的选项。我不确定如何/何时禁用它,但启用它并重新启动 chrome 已经解决了我的所有问题。

回答by jaredwilli

Yeah, if you want to search within content sources which are scripts used by extensions and the internal browser API, you enable it in the Settings of DevTools and then from any panel in DevTools you can type Ctrl+ Shift+ For (on Mac) Options+ Command+ F(??F) to search across all sources, snippets, and files.

是的,如果您想在扩展程序和内部浏览器 API 使用的脚本的内容源中进行搜索,您可以在 DevTools 的设置中启用它,然后从 DevTools 的任何面板中您可以键入Ctrl+ Shift+F或(在 Mac 上)Options+ Command+ F( ??F) 搜索所有来源、片段和文件。

Even more helpful to what you may be needing is to set up a Workspace in Settings cog which you can map to a local directory of files which will be available in the Sources file browser sidebar which will also be searchable with the above shortcut.

对您可能需要的更有用的是在设置 cog 中设置一个工作区,您可以将其映射到本地文件目录,这些文件将在源文件浏览器侧栏中可用,也可以使用上述快捷方式进行搜索。

回答by kenorb

Latest version of DevTools

最新版本的开发者工具

Click on the triple dot icon on the right of DevTool dock, and choose Search.

单击 DevTool Dock 右侧的三点图标,然后选择Search

Or just hit: Control-Shift-Fwhile using DevTools(Control-Shift-I).

或者只是点击:Control- Shift-F使用DevTools( Control- Shift- I)。

DevTools Dock menu

DevTools Dock 菜单



Older version of DevTools

旧版本的DevTools

Activate 'Search in content scripts' option in DevTools General Settings. It will allow content scriptsto be searchable.

激活DevTools 常规设置中的“在内容脚本中搜索”选项。它将允许内容脚本可搜索。

Then in DevToolspanel you can search the source files at the bottom of the panel.

然后在DevTools面板中,您可以在面板底部搜索源文件。

For example:

例如:

Google Chrome - Content scripts - Search in sources

谷歌浏览器 - 内容脚本 - 在来源中搜索



If you don't have the Searchtab in bottom of DevToolspanel, click on the triple dot icon to open it.

如果DevTools面板底部没有Search选项卡,请单击三点图标将其打开。

Chrome/Chromium - DevTools Search in source code files

Chrome/Chromium - DevTools 在源代码文件中搜索

回答by Patrick S

I was facing same issue CTRL+SHIFT+F wasn't working anymore.

我遇到了同样的问题 CTRL+SHIFT+F 不再工作了。

  1. Press f12 to open developer tools
  2. Click on vertical ellipsis on the right side of developer toolbar to open its options
  3. Click "More Tools"
  4. Click on "Search"
  1. 按f12打开开发者工具
  2. 单击开发人员工具栏右侧的垂直省略号以打开其选项
  3. 点击“更多工具”
  4. 点击“搜索”

enter image description here

在此处输入图片说明

回答by Xavave

In case it still doesn't work, check if this extension is installed in your chrome :

如果它仍然不起作用,请检查您的 chrome 中是否安装了此扩展程序:

form filler: https://chrome.google.com/webstore/detail/form-filler/bnjjngeaknajbdcgpfkgnonkmififhfo?hl=en

填表:https: //chrome.google.com/webstore/detail/form-filler/bnjjngeaknajbdcgpfkgnonkmififhfo?hl=en

CTRL+SHIFT+F was still not working for me but then I discovered that chrome extension "Form Filler" was overriding the "search all" in console command

CTRL+SHIFT+F 仍然对我不起作用,但后来我发现 chrome 扩展“Form Filler”覆盖了控制台命令中的“search all”

To change this : go to url --> chrome://extensions/

要更改此:转到 url --> chrome://extensions/

then go to the bottom right : Keyboard shortcuts and you can change + CTRL+SHIFT+F command for form filler

然后转到右下角:键盘快捷键,您可以更改 + CTRL+SHIFT+F 命令用于表单填充

then the command CTRL+SHIFT+F in chrome search console worked again

然后 Chrome 搜索控制台中的命令 CTRL+SHIFT+F 再次起作用

回答by Achal Gupta

In the latest version CTRL+SHIFT+F doesn't work anymore even after enabling "Search in anonymous and content scripts".

在最新版本中,即使启用“在匿名和内容脚本中搜索”,CTRL+SHIFT+F 也不再起作用。

Steps1) You need to click on the three edits either at the top right or the bottom left of the dev tools. enter image description here

步骤1) 您需要单击开发工具右上角或左下角的三个编辑。 在此处输入图片说明

2) You will see an option of search which is what you want.

2)您将看到一个搜索选项,这正是您想要的。

3) Also the search tab is present at the bottom.So it might not be visible so you might have to drag the tab up. enter image description here

3) 搜索标签也出现在底部。所以它可能不可见,所以你可能需要向上拖动标签在此处输入图片说明