244

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

  • JS in inline script tags

  • JS inside iframes.

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?

Gama11
  • 31,714
  • 9
  • 78
  • 100
Frances McMullin
  • 5,516
  • 2
  • 18
  • 19
  • 9
    Be careful - the accepted answer works with CTRL+SHIFT+F and "Search in content scripts" enabled, but Chrome only counts 1 match per line, even if there are multiple matches on any given line. With minified JS you'll see this often. I had thought this was a Chrome bug until I realized it would find all instances if you click into the script in question and CTRL+F there. – JD Smith Oct 10 '14 at 18:45
  • Great point! I have found some inconsistent behaviour with chrome, especially after upgrades, between this "search in content scripts" setting and pretty printing minified scripts, sometimes things don't work perfectly =( – Frances McMullin Oct 10 '14 at 19:15
  • 1
    Actually, there are times when Chrome simply will not find something. It happens to me often. For example, when I visit http://www.band-aidbrandfirstaid.com/first-aid-how-to-videos and search the source for _satellite.jwp.videos I see no results. Yet that string is present - [screenshot](https://www.flickr.com/photos/39885838@N00/15547981008/) I can't seem to find anyone else with this problem. For now I use Firefox and it finds it just fine. – JD Smith Nov 07 '14 at 18:27
  • That is curious indeed! I have tried the same search in my chrome and it worked fine (found 5 matches). Have you tried enabling the option mentioned in my answer below? – Frances McMullin Nov 10 '14 at 21:08
  • Yes, I did notice at one point that my box was not checked either. But after I checked it, I still see the problem, and I've even done a few restarts and Chrome updates since then. Pretty strange. – JD Smith Nov 25 '14 at 03:11
  • 2
    The frame can also be squashed all the way to the bottom of the console window (at least it was for me). Drag it up so you can see if better. – Emery Lapinski May 06 '15 at 17:37
  • Possible duplicate of [How to search all loaded scripts in Chrome Developer Tools?](http://stackoverflow.com/questions/4145266/how-to-search-all-loaded-scripts-in-chrome-developer-tools) – Dan Dascalescu May 04 '17 at 00:21
  • Perfect!!!!!!!!!!!!! – mjs Aug 18 '17 at 09:31

6 Answers6

248

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 + F or (on Mac) Options + Command + F (⌥⌘F) to search across all sources, snippets, and files.

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.

Darryl Hein
  • 142,451
  • 95
  • 218
  • 261
jaredwilli
  • 11,762
  • 6
  • 42
  • 41
  • 14
    As per another comment it may be useful to explain how to enable the search i.e.(from another answer) "Activate 'Search in content scripts' option in DevTools General Settings" – samneric Mar 01 '17 at 17:23
  • 3
    This is out of date – cdeutsch Mar 14 '19 at 14:22
  • 20
    In the current version of Chrome, DevTools > Settings > Preferences > Sources "Search in anonymous and content scripts" – Mark Hansen Sep 11 '19 at 03:01
  • Agreed this is out of date. Also would be great to clarify where in Dev Tools Settings this should be enabled. – Max MacLeod Oct 21 '19 at 14:05
61

There is an option under Settings -> Preferences -> Sources called "Search in anonymous and content scripts".

I'm not sure how/when I disabled this but enabling it and restarting chrome has fixed all of my problems.

mit
  • 11,083
  • 11
  • 50
  • 74
Frances McMullin
  • 5,516
  • 2
  • 18
  • 19
  • 4
    It would be nice if Chrome prompted us to enable this option when doing CTRL+SHIFT+F. I don't recall disabling it either, but one day it stopped working. Thank you for saving me from using Firefox for this purpose! – JD Smith Oct 10 '14 at 12:13
  • 1
    I am pretty sure that it was searching among all sources before but suddenly it stopped! now with checking that option it is working again! thanks – Bakhshi Oct 15 '14 at 02:14
  • I had the exact same experience, I love chrome most of the time but sometimes find unexpected behaviour after updates =( Glad it's working again now! – Frances McMullin Nov 03 '14 at 23:02
  • 7
    In Chrome 56, you will find this option under [DevTools menu on top right of DevTools window] -> Settings -> Preferences -> Sources -> "Search in content scripts" (checkbox at the very bottom) – Chris Apr 03 '17 at 09:14
  • 7
    For me, in Chrome 69, it's now called "Search in anonymous and content scripts" – Jono Jul 13 '18 at 09:04
47

Latest version of DevTools

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

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

DevTools Dock menu


Older version of DevTools

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

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

For example:

Google Chrome - Content scripts - Search in sources


If you don't have the Search tab in bottom of DevTools panel, click on the triple dot icon to open it.

Chrome/Chromium - DevTools Search in source code files

kenorb
  • 155,785
  • 88
  • 678
  • 743
13

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

  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"

enter image description here

Patrick S
  • 490
  • 5
  • 17
11

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

Steps 1) 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

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

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

Achal Gupta
  • 424
  • 4
  • 15
5

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

form filler: 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

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

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

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

Xavave
  • 645
  • 11
  • 15