How to search all loaded scripts in Chrome Developer Tools?
Asked Answered
P

7

462

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

Pamalapamela answered 10/11, 2010 at 14:3 Comment(4)
BTW, if you are using Source Maps (e.g. with GWT Super Dev Mode), you can search the mapped .java files by name... Type Ctrl + O (command + O on mac) in the Sources tab.Suchta
May I suggest changing the accepted answer to vsevik's? It's much more likely to be useful for today's readers.Immotile
Glad! Got Perfect answer for this question but search in network response is not available just like in Firebug, now not even in firefoxTiny
Use 'Go to file' in Google Dev Tools (a flexible and useful tool with ability search on your function name, class name in CSS,...). How to use Go to file in Google Chrome DevToolsTafoya
T
711

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

Tempt answered 1/11, 2011 at 17:19 Comment(13)
Control+Shift+F is quite useful but doesn't return all hits, especially scripts inside iframe.Pickaxe
If Control+Shift+F is the way to go, then the upper search box is utterly misleading. Secondly, the search and hunt UI work flow is horrible. How much can you really fit in that tiny area? Why not do it like FF does?Unexampled
Works well, but it take much longer than in FF. Chrome Dev Tools need many improvements yet... =(Hermia
Be sure that Developer Tools is in it's own window, if DT is docked to the main window, the command Ctrl + Shift + F will not pull up a search for sources, it will instead run a default search.Cookbook
The fact that I had to google for this is telling much about UX of Chrome Dev Tools.Matutinal
Does this still work? Ctrl+shift+f in inspector doesn't do anything on macToulouse
how do you search a complete expression instead of returning partial matches?Bentwood
doesn't work with latest version of chrome - atleast doesn't show all results, few results may or may not be shown (unpredictable behavior)Kassia
According to praterade, "in regards specifically to Murali VP and coding_idiot's comments, make sure 'search in content scripts' is checked in the inspector settings. This will return results from within iframes and HTML."Oulman
Search in content scripts was what I needed for months now totally missed that checkbox.. not that intuitive..Accoutre
It's worth mentioning Ctrl + P to quickly search and open a filename in the sources.Landgraviate
Can't find the search field? This is a little gotcha: You have to select the grey bar to the right of the "Search" tab, and pull it up! In the bottom right corner in this screenshot: dropbox.com/s/bxfhmr4oan2mg2v/…Tailpipe
Oh my goodness that global search bar at the bottom was obscured by the code window on my display. I had to re-adjust the window.Nader
G
16

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

Gilges answered 31/8, 2015 at 3:54 Comment(1)
This answer is essentially the same as the top-voted one, which I've updated to include Console -> Search.Professionalism
M
12

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

Mechelle answered 22/12, 2016 at 19:30 Comment(4)
Doesn't exist anymore? I don't see it on Windows.Skiffle
No longer exists as of Chrome 58.Professionalism
Exists again in current versionRodina
I don't see it in Chrome version 79 on mac os.Carisacarissa
I
0

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.

Ignore answered 8/3, 2018 at 14:51 Comment(0)
H
0

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

Hardunn answered 26/10, 2018 at 21:32 Comment(1)
Top rated answer still works if you check "Search in anonymous and content scripts" from the settings. BTW your answer is not related with what is being asked; this is for searching file names only, not the content.Delladelle
M
0

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

Mute answered 16/11, 2018 at 16:35 Comment(0)
B
0

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.

Bobodioulasso answered 8/8, 2019 at 9:33 Comment(1)
Yes, this is it. I was analysing a Vue website and the data I was looking for was being dynamically loaded.Deign

© 2022 - 2024 — McMap. All rights reserved.