I want to disable a specific JS script from a specific website without disabling the javascript completely. Is there a way to do that ?


(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*

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.


You may use uBlock Origin in Chrome and Firefox:


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.

  • Please quote the relevant sections from the linked answer.
    – Burgi
    Sep 26 '17 at 2:07
  • I didn't see any point in unnecessary duplication. I would have to post the entire contents of the answer including the images, and if I did that then anyone looking for this answer would miss the comments and other answers to the question in stackoverflow. In reality that question is really a duplicate of this one, but is has much better answers than the ones posted here.
    – Gavinvin
    Sep 26 '17 at 2:21
  • 4
    but if anything happens to the SO answer, a fair bit of the utility of your answer goes away. A certain amount of duplication between sites is fine
    – Journeyman Geek
    Sep 26 '17 at 2:59
  • This should be the best answer, you don't need to install anything. Thanks!
    – Edenshaw
    Feb 21 '20 at 17:28

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:
    1. The complete path to the file (www.domain.com/scripts/ascriptyoudontlike.js)
    2. Any file in that subdomain (www.domain.com)
    3. Any file in that domain (domain.com)
    4. 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.


If you're using Firefox, the NoScript plugin will allow you to do this.


  • +1 - NoScript is exactly what you seek. As far as I know you'll need the Firefox browser to use it. Great extension.
    – boehj
    May 4 '11 at 6:41

AdBlock Plus does it but doesn't this concern a security risk? In the real world disabling a JS might cause problems to an application (as for example an XSS attack by disabling the .js that checks for validation in user inputs) or anyway any check on the userside and not the server side.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.