Is there a way to disable a specific JS script from a specific website?
Solution 1:
(Reference: http://noscript.net/faq#qa8_10)
After installing NoScript, open its option (by opening context menu on the small icon on the status bar/add-on bar, or through Addons Manager)
Go to Advanced tab. In that page, go to ABE tab. Under Rulesets, click on USER. Here is an example ruleset, put it in the textbox on the right:
# User-defined rules. Feel free to experiment here.
Site http://res.nimg.jp/js/ads.js*
Deny
I'm not sure how URL matching works, whether it uses regexp or not. Some examples on the FAQ does show regexp usage, but my example above seems to also match ads.js?foobarbaz
.
Solution 2:
You may use uBlock Origin in Chrome and Firefox:
https://github.com/gorhill/uBlock/wiki/The-logger#creating-filters
Solution 3:
Chrome has this functionality built in now, its comes under Request Blocking in the dev tools. This answer over on StackOverflow has a great description on how to use it.
Solution 4:
If you are using Firefox, you can also use AdBlock Plus to block all functions in a specific file. (Instructions below are for Windows.)
- In the toolbar, click the AdBlock Plus icon, and select Open blockable items from the menu.
- A window will appear, listing everything that ABP can block. You can scroll through the list to find the particular script file or you can type in the Search box to narrow the list down. Once you've found the file to block, right-click the file and select Block this item ....
- ABP will create a new filter based on that file and will list several options for you:
- The complete path to the file (www.domain.com/scripts/ascriptyoudontlike.js)
- Any file in that subdomain (www.domain.com)
- Any file in that domain (domain.com)
- A custom rule that you can define; by default, this starts off the same as 1.
- Click the radio button next to the first option and click Add filter. This will close the window and add that JavaScript file to the list of blocked items.
You may need to refresh the page to ensure that file is blocked.