Home > Blockchain >  How do I find the file that is pulling in a script in web inspector?
How do I find the file that is pulling in a script in web inspector?

Time:10-28

One specific example is I see multiple versions of jQuery on my website. How do I know what's pulling in jQuery? I don't see it in my source code, so it must be another integration that's pulling it in.

It's not just jQuery though. I'd also like to track down where additional scripts are coming from.

I looked in web inspector and see multiple iterations of jQuery being loaded. I then searched the source code of my site for "jquery" in an attempt to find the source with no results.

CodePudding user response:

In Chrome, you can open the devtools with control-shift-i (Windows). Go to the Network tab. Reload the page. In the table that appears in the devtools, click "Type" to sort by the type of request - look for script. From there, you can look through the different scripts to see which one(s) are the ones you're looking for, and click on the "Initiator" for that row to see what initiated the request for that script.

For example, for Stack Overflow, you'll see something like:

enter image description here

And clicking on that row takes you to the location in the HTML where there's a script tag:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

CodePudding user response:

Open the network tab in the browser's dev tools, switch to the JS sub-tab, and look for requests for jQuery. Select one and look at the initiator column to see why it was requested.

enter image description here

  • Related