Table of Contents
“On some sites, when I click on a link (or anywhere on the page, i.e., in the input fields or just in the middle), it opens the link (or the same page) in a new tab and in the previous tab where I was initially loading some ads or other unwanted things.”
Many websites on the Internet have specific ad overlays on important links that uncontrollably open new tabs. This is a new trend that is used by many websites to monetize your clicks but can quickly become annoying if you don’t need time. Here I’ll discuss How to Block Unwanted Tabs from Opening in Firefox.
Why does Firefox keep opening new Tabs?
Website monetization is how traffic to a targeted site is used to generate revenue. This means that the site owner is paid a certain amount for advertising placed on the site. To generate revenue, a user must click on these ads (pay-per-click monetization) or view ads for a specific time (cost per impression), etc.
You can also read: Best Browsers for Safe and Private Browsing: Top 6
These ad overlays are a standard method of deception used by website owners to get the user to click on ads and therefore generate revenue in the process. Many websites and streamers use this method of cheating to monetize your clicks.
This can become very annoying if regular and repetitive redirects, especially when you’re short on time and need quick fixes.
How do I prevent websites from opening new tabs in Firefox?
New windows are opened using the JavaScript Window.open() command. If you want to block new windows from opening constantly, you can disable JavaScript in your browser.
While this will also disable some other essential features, this option may seem unrealistic. Instead, follow these steps to learn how to prevent websites from opening new tabs in Firefox.
Mozilla Firefox has several built-in tools that you can use to combat this situation. While we don’t recommend blocking ads entirely, you can disable intrusive ads that degrade performance.
Stop Firefox uncontrollably opens multiple tabs in Mozilla Firefox by following these steps:
- Open a new tab in Mozilla Firefox.
- Enter the following in the addressbar and press enter:
about:configuration - Click on Accept the Risk and Continue button to open the Mozilla Firefox settings page.
4. Now, find the following entries by copying and pasting them into the search toolbar:
dom.disable_window_open_feature.location
dom.disable_window_move_resize
5. Right-click on these entries and click the toggle switch to change your values to True.
6. Next, look for “dom.popup_allowed_events“
7. Limit the events that pop-ups can trigger. The default setting is: “Change click dblclick mouseup pointer up notificationclick reset submit send touch.” Remove some or all of these events, depending on how you see fit.
The Document Object Model service calls the APIs and object modules present in the browser. Pop-ups are a feature called the DOM Service. You can set all the “dom.disable_window_xxx” so that the truth does not allow sites to do their machinations.
8. Then, change the following entries to the data value specified next to them.
- browser.link.open_newwindow => 3
- browser.link.open_newwindow.override.external => -1
- browser.link.open_newwindow.restriction => 0
Using this method, you can disable Unwanted Tabs from Opening in Firefox.
For advanced users (User instructions.js)
If you’re an advanced user, you can deploy a more permanent solution to “Firefox opens multiple tabs” doesn’t open additional windows in the browser. The JavaScript file will block your changes and prevent advertisements from modifying them.
Note: If an entry for a preference setting exists in the user.js file, any changes you make to that setting in the settings and options dialogs or using about:configuration will be lost when you restart the Mozilla application, the user.js entry will override it.
You need to run a JavaScript file that will apply the changes to do this. Here are the steps you can follow:
- Close all instances of Mozilla Firefox that are open on your system.
- Open the Run dialog box by clicking Win + R.
- Type %APPDATA%\Mozilla and click Login to open the Mozilla Firefox configuration folder.
- Here, double-click Fire Fox.
- Next, select the profiles.
- Now open the folder that ends with the .default-release. It is preceded by a random number based on the installation of your browser. On my system, this is 0cncspd2.default-release.
- In this folder, open your preferred text editor and save the file as User.js.
If you’re using Notepad, make sure you change the file type to All Types. If you don’t, the file will be saved as User.js.txt, which is practically useless for this purpose.
Like me, you’re using Visual Studio. Right-click in the folder and choose Open with Code. Then click on New File to open the new editor and name it User.js.
8. Copy the following script and paste it into a text editor.
Advanced JavaScript settings:
user_pref (“dom.disable_window_move_resize”, true)
user_pref («dom.disable_window_open_feature.directories», true);
user_pref («dom.disable_window_open_feature.menubar», true);
user_pref («dom.disable_window_open_feature.personalbar», true);
user_pref («dom.disable_window_open_feature.scrollbars», true);
user_pref («dom.disable_window_open_feature.toolbar», true);
9. Save the file with the extension above and close the editor.
10. Update the folder and launch Firefox.
You’ll now see that all external links, including click-through ads, open in a new tab, and overlays don’t open at all.
Precaution: Valid settings that you add to the user.js file are automatically copied to the prefs.js file (located in the same profile folder), where all user settings are stored. For this reason, you should make a backup copy of the prefs.js file before creating or editing the user.js file.
You can also read: 7 Websites to Check Accounts for Password Leaks and Hacks.
Conclusion
Many websites use advertising revenue to monetize their traffic. But they deceive their audience with advertising overlays, where clicking on links opens a new window can become annoying. You know how to prevent websites from opening new tabs in Firefox using the method above. Comment below if you found it helpful, and discuss further the same.