7

Often, I would like to look for particular strings in the JavaScript or CSS of a webpage in Firefox. Today what I do is download the entire site for offline viewing and search that way, which is effective but cumbersome.

Is there a way to search across all JavaScript and CSS this way? (Assume that the browser has already downloaded the file as part of loading the page.)

Alternatively, if Firefox itself doesn't do this, is there something that can (e.g. an extension, a different browser)?

2 Answers 2

6
  • Press F12 to open the Developer Tools.
  • Click the Debugger tab (if it isn't visible, click ❱❱ and select it from the list).
  • Press Shift+Control+F.

https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Search#searching_in_all_files

enter image description here

Click on any entry in the list to go directly to the line in the file where the string occurs.

3
  • 3
    However, in Firefox this works only for Debugger tab, i.e. for Javascript/Typescript sources, not for CSS. In Style Editor tab, I was not able to find any global search. In Developer Tools of Chrome and new Edge, fortunately there is just one tab called Sources, where you can search for JS or CSS (same shortcut, Shift + Control + F).
    – jirkamat
    Commented Nov 6, 2021 at 18:19
  • 1
    There is a feature request in Bugzilla asking for search across all sources participating in styling: bugzilla.mozilla.org/show_bug.cgi?id=889571
    – myf
    Commented Mar 8, 2022 at 12:26
  • This does not work. Shift + Command + F just toggles Firefox full screen on/off. Firefox version 102.0.
    – Jonny
    Commented Jul 4, 2022 at 1:29
1

As a workaround, it's possible to use the Network tab search function in dev tools. The search will honor filtered assets, if you have selected only CSS or JS for ex. it will make a full text search only on filtered XHR and JS requests.

It's basic but effective.

Remember that it's possible only to search in recorded requests, so it may be necessary to reload the page.

network toolbar search screenshot 1 from the docs

network toolbar search screenshot 2 from the docs

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .