Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome DevTools search all javascript files in website

I'm working on a new client's website that loads Javascript from a CDN so the Javascript is not embedded or inline with the webpage source. I would like to pause everytime getCurrentPosition() is executed in order to determine which external JS file it is contained in.

I realize I could use other tools to do a string search through the contents of the JS files but I would rather keep to Chrome's debugging tools.

Should I be trying to create a watch expression or is there another way to pin down when and where a certain JS function is fired?

like image 792
sparecycle Avatar asked Jun 07 '16 17:06

sparecycle


People also ask

How do I find files in dev tools?

You can easily access any file within a current project or web page by pressing Cmd + P ( Ctrl + P ) when Chrome DevTools is open and searching for the name.

How do I search all scripts?

Use Ctrl+Shift+F and then type the word char. It will search in every scripts.


1 Answers

You can search in all files using Chrome DevTools. Find your function and debug it:

  1. Open DevTools (F12)
  2. Go to sources tab
  3. Open Search All Files by pressing ctrl + shift + f (Win) or cmd + option + f (Mac)
  4. Search getCurrentPosition
  5. Put a breakpoint (By clicking the line number at the left of the line)

enter image description here

like image 61
Jaqen H'ghar Avatar answered Sep 19 '22 21:09

Jaqen H'ghar