For example if I run on some page in Chrome with following code:
<div onclick="someFunction('test')"></div>
I would like to know which js file contains "someFunction". Is it possible and how? (I suppose it could be done with debugging but don't know how)
In Firefox with Web Developer add-on, Information/View Javascript/Expand All, search for "someFunction".
There are of course, a lot of other ways to do this too, but this add-on puts all JS from the page into one browser which makes it simple to search for anything page-wide.
what I do is: [ Assuming you have access to the source code ]
grep -r "function someFunction" .
where .
is directory where to begin recursive search for the pattern. It will show you all files which contains pattern "function someFunction".
By the way, if you have a lot of hits but you want to search in the directory which generates them, you can discard results that contains:
grep -r "function someFunction" | grep -v "withouth this text"
hope that helps! on windows maybe you can use this with cygwin ?
This of course will not work if someFunction is hosted on external host...
Try to save page in file system (menu -> save page as -> web bage completely) and find you function in files by text searcher.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With