
JavaScript is one of the key elements most websites and web apps run on, but it’s also one of the most easily exploited. Not only is it used in analytic tools, ads, and browsing trackers, hackers often use JavaScript to deploy malware, it makes you easily trackable in some circumstances, and it can even accidentally leak important data.
In fact, a recent study found that popular websites running JavaScript have leaked over a million user emails to advertisers and other analytics companies in 2020 alone. The list of sites includes The Washington Post, Mailchimp, Wish, and even the recently launched video streaming service Quibi. Worse, many of these websites were doing so unwittingly and even undermined other security measures they had in place that should have kept user data safe.
Should you just disable JavaScript in your browser?
You might not have to. Some browsers and privacy add-ons will outright block JavaScipt from running by default, while most other modern browsers include options to limit or prevent JavaScript at the user’s request.
While disabling all JavaScript entirely would theoretically prevent the data leaks and potential malware attacks that rely on JavaScript, it will also make many websites harder to use, or even prevent them from loading entirely—like Google Maps, for example.
Luckily, there’s a middle-way approach here, which is to manually allow JavaScript to run only on certain websites and block JavaScript from running when you’re unsure.
How to change your browser’s JavaScript settings
Not all browsers include the same JavaScript settings, so the exact options available to you will differ based on what you’re using.
Some privacy-focused browsers, like Brave, will ask you if you want to run JavaScript when loading a new page, while Tor blocks all JavaScript by default, no exceptions.
For most other browsers, however, you’ll need to change the JavaScript settings manually.
Chrome
Open the URL chrome://settings/content/javascript
Deselect the “Allowed” toggle to block all JavaScript.
You can add websites to the Block/Allow lists to create exceptions to your current settings.
Exit and restart Chrome.
Edge
Go to edge://settings/content/javascript using the URL bar
Disable the “Allowed” toggle to block all Javascript
You can then add specific websites to the Block/Allow lists to create exceptions to your current settings.
You’ll need to restart Edge for the settings to take effect.
Firefox
In Firefox, go to about:config
If you get a warning message saying this may void your warranty, ignore it and click “I accept the risk” to continue.
Use the search bar to find javascript.enabled
Double click javascript.enabled so it’s listed as “disabled” to turn off all JavaScript.
Relaunch Firefox.
If you don’t want to disable JavaScript entirely, you can use a Firefox add-on like Disable JavaScript to allow/block specific websites when they load.