Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable a Single JS Script in Chrome Dev Tools

I have a page that loads a number of JS libraries from a CDN (Including jQuery and jQuery UI). I am testing a local script, and I want to check if the script will run properly if I disable some specific libraries. Is there a way to use Chrome Dev Tools to disable one or more of the JS libraries I'm loading?

For example, let's say I load the following:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>

Then, say I have a script on the site:

<script>...some script that runs when an element is clicked...</script>

I want to test and see if my local script will run if I disable one or both of the libraries. How do I use Chrome Dev Tools to do this and test?

like image 756
alloy Avatar asked Nov 10 '22 19:11

alloy


1 Answers

You can use Charles web proxy to re-route the cdn files so they load from your local machine. I'm not sure if this is possible with dev-tools alone.

Why don't you comment out the scripts so they don't load? That would be the simplest solution. You can run the site locally, correct?

like image 118
posit labs Avatar answered Nov 14 '22 22:11

posit labs