-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Per site switches
Back to "Quick guide: popup user interface"
The per-site switches allow you to control uBlock Origin (uBO)'s behavior on a per-site basis.
Changes to the state of per-site switches are temporary until you make them permanent by clicking the padlock icon. Pressing Ctrl (Cmd on Mac) when toggling switches will make them permanent immediately.
Eraser and padlock icons
By default, popups are allowed unless there is a filter to block them. When this setting is enabled, all popups will be unconditionally blocked for the current site, regardless of filters:
The badge shows the number of popups that have been closed on the page.
No popups rules appear as no-popups: [hostname] true
entries in the My rules pane.
Blocking popups depends on whether the proper filters are present in the selected filter lists, so this feature is most useful when a site creates popups for which there are no filters to take care of them in 3rd-party filter lists.
On mobile devices, the "No popups" icon is not available because of screen space issues. If you like, you can turn it back on in advanced settings.
Caveat: It's not always possible for uBO to determine for sure whether a new tab being opened is that of a popup, or is the result of a legitimate click on a link by the user. So if the no-popups switch is in use, you may not be able to open a link in a new tab through the context menu. See related issues over years:
- (03.2015) [Chrome] "Block all popups" also blocks "open link in new tab"
- (04.2015) Block Popups blocks "Open in New Tab" on some sites.
- (04.2016) A "no-popups: * true" rule will block new tabs opened from "chrome://extensions/"
- (11.2016) Popup Blocker blocks opening New Tab
- (08.2017) Middle clicking on a link triggers popup rule, but only since updating to webext-hybrid.
- (11.2017) The no-popups rule blocks "Open in a new tab" user action
- (01.2018) Treating legitimate tabs as popups.
- (03.2020) There must be a way to disable popup blocking
- (10.2024) uBlock Origin breaks "Open image in new tab" when there is a rule to block popups
Hence there is no point in spamming the issue tracker by creating new duplicates over and over, discussion and sharing opinions should be continued in already existing threads, new threads will be labeled as invalid
or duplicate
and closed.
The second icon is to toggle on/off the blocking of large media elements for the current site. The primary purpose of this feature is to save bandwidth. A side effect is to possibly speed up the page load.
The badge shows the number of large media elements that have been blocked on the page.
By default, this setting is disabled. The global default can be enabled in the Settings pane in the dashboard.
The threshold size -- a global setting -- to decide when to block or not is also configurable. The threshold size can be set to zero: this will cause all media elements to be blocked. For the sake of documentation, let's refer to media elements (images, videos, audios) that are larger than the set size as "large media elements".
You can enable/disable on a per-site basis, there is a switch in the popup panel to toggle for the current site.
When large media elements have been blocked on a page, you may force a reload of these elements interactively: if you hover over the placeholder of a blocked image and the cursor changes into a magnifier, this means that clicking on a blocked image will force a reload of that image. Blocked large media elements have a red border around by default, you can try to change the border color, size and style by using uBO's filters with :style() operator, more info available in discussion: Disable red border for blocked large media elements.
If you use this feature and large media elements were blocked on a web page, the context menu will contain a new entry: "Temporarily allow large media elements". When you click this entry, uBO will disable temporarily the blocking of large media elements for the site, and attempt to load the blocked media elements without reloading the page. In some cases, you may need to force a reload of the page, for example, if large media elements were fetched programmatically by the page. The temporary disabling will be removed for a tab as soon as you travel to a new site, or close the tab.
Blocked large media elements are reported in the logger with the filter no-large-media: [scope] true
.
Note that this feature has no privacy value: a connection to the remote server must be performed in order to fetch the size of the resource. This of course applies only to resources that were not otherwise blocked by uBO's filtering engine.
Examples of usefulness (let's say you just stumbled onto these pages not knowing whether the article would really interest you), bandwidth consumed:
-
https://www.wired.com/2016/01/drones-arent-just-toys-anymore/
- Not blocking large media elements: 5.5 MB.
- Blocking media elements larger than 1 MB: 2.1 MB.
- Blocking media elements larger than 50 kB: 1.2 MB.
-
https://www.tomshardware.com/reviews/samsung-gear-vr-headset,4405.html
- Not blocking large media elements: 15.1 MB.
- Blocking media elements larger than 1 MB: 15.1 MB.
- Blocking media elements larger than 50 kB: 61 kB.
-
https://twitter.com/ (your Twitter stream):
- Not loading largish images by default can help Twitter page performance: click on a placeholder to load only the images which seem to be of interest to you.
- This is true for any "infinite scrolling" web pages (another example). Not loading the images by default help a lot in such cases.
If the media elements do not have a Content-Length
header present, then this switch will fail to block the said media elements by size.
Starting with 1.60.1b2 Blocking large media elements also prevents autoplay, regardless of size.
When the "No large media elements" per-site switch is toggled on, it will also act to prevent autoplay of video/audio media, regardless of their size. This also works for xhr-based media streaming.
If blocking by size is not desirable while blocking autoplay is desired, one can toggle on "No large media elements" switch while setting "Block media elements larger than ..." to a very high value.
Related issues:
- Prevent videos from playing automatically
- https://github.com/uBlockOrigin/uAssets/discussions/25007
Keep in mind that Firefox, unlike Chrome, has already built-in native "no autoplay" functionality: https://support.mozilla.org/en-US/kb/block-autoplay, hence the uBO's "no autoplay" feature is most desired in Chrome. Other way on Chrome is to use AutoplayStopper extension. Another alternative way, which works on Chrome & Firefox, is to use uBO's click2load functionality.
"Cosmetic filtering" in uBO is what is known as "element hiding" in Adblock Plus (ABP). The purpose of these filters is to hide the content of the page that cannot be blocked by network filters.
You can easily toggle on/off cosmetic filtering for a given site:
The badge shows the number of DOM elements that have been hidden on the page.
When present, the badge number indicates the number of elements hidden on the page by uBO as a result of cosmetic filtering. If you disable cosmetic filtering while there are hidden elements on the page, these elements will become visible/hidden as you toggle off/on cosmetic filtering.
A good example of cosmetic filtering in action is the ads showing up with the results of a Google Search page (example).
Cosmetic filtering is always enabled by default.
Tips
It is often suggested adding a custom static filter such as
@@||example.com^$elemhide
or@@||example.com^$generichide
to prevent "adblock" detection by specific sites (example, example). You can accomplish the same goal more simply by just toggling off cosmetic filtering using this switch while on the problematic site.This switch can help uBO to further lower its CPU-cycle footprint, which might be beneficial on devices with limited CPU-cycle resources -- and thus helping extend battery life and speed up page load times. The idea is to disable cosmetic filtering everywhere by default and to enable it only for those sites which really benefit from it.
To disable cosmetic filtering everywhere by default, go to the Settings pane in the dashboard, and check the option "Disable cosmetic filtering" under the "Default behavior" header:
From then on, cosmetic filtering will be turned off everywhere by default, and to turn it on for a specific site where it is really needed, just enable it using the switch in uBO's popup panel.
Element picker will not allow to select arbitrary elements to create cosmetic filters when this option is enabled - it will create only network filters (for ex. for images).
You can prevent web fonts from being downloaded for the current site:
The badge shows the number of font resources that have been seen on the page.
Because of security and privacy concerns, many prefer to block all web fonts by default -- toggle the appropriate default behavior in the Settings pane in the dashboard:
This will block all web fonts everywhere by default, and in this case, you can toggle off the switch to allow web fonts on a per-site basis.
Keep in mind, though, that this rule blocks all first-party and third-party fonts. As a lighter alternative, you can also choose to allow first-party fonts and block only third-party fonts by adding the filter
*$font,third-party
to the "My filters" pane. If you want to allow third-party fonts for some specific sites you can add them by modifying the above filter:
*$font,third-party,domain=~example.com|~other.example.net|~different.example.org
New in 1.17.0
Wholly disable JavaScript for a given site.
The badge shows the approximate number of script resources that have
been seen on the page (the number is limited to 99 because of layout constraints)
Starting with v1.21.7b5, a purple badge on uBO toolbar button indicates activation of the "No scripting" switch.
This master switch has blocking precedence over dynamic filtering rules and static filters related to script resources.
When JavaScript is disabled through this master switch, noscript
tags will be (tentatively) honored on a page (as opposed to when just using filters/rules to block script resources). The activation of noscript
tags is done through a workaround, and there might be cases where it's not possible for uBO to mimick perfectly activated noscript
tags.
As with some other per-site switches, the default state of the per-site JavaScript master switch can be set in the Settings pane, thus allowing to disable JavaScript everywhere by default, and enable on a per-site basis:
JavaScript master switch rules appear as no-scripting: [hostname] true
entries in the My rules pane.
The JavaScript master switch can be disabled through the "Relax blocking mode" keyboard shortcut.
uBlock Origin - An efficient blocker for Chromium and Firefox. Fast and lean.
- Wiki home
- About the Wiki documentation
- Permissions
- Privacy policy
- Info:
- The toolbar icon
- The popup user interface
- The context menu
-
Dashboard
- Settings pane
- Filter lists pane
- My filters pane
- My rules pane
- Trusted sites pane
- Keyboard shortcuts
- The logger
- Element picker
- Element zapper
-
Blocking mode
- Very easy mode
- Easy mode (default)
- Medium mode (optimal for advanced users)
- Hard mode
- Nightmare mode
- Strict blocking
- Few words about re-design of uBO's user interface
- Reference answers to various topics seen in the wild
- Overview of uBlock's network filtering engine
- uBlock's blocking and protection effectiveness:
- uBlock's resource usage and efficiency:
- Memory footprint: what happens inside uBlock after installation
- uBlock vs. ABP: efficiency compared
- Counterpoint: Who cares about efficiency, I have 8 GB RAM and|or a quad core CPU
- Debunking "uBlock Origin is less efficient than Adguard" claims
- Myth: uBlock consumes over 80MB
- Myth: uBlock is just slightly less resource intensive than Adblock Plus
- Myth: uBlock consumes several or several dozen GB of RAM
- Various videos showing side by side comparison of the load speed of complex sites
- Own memory usage: benchmarks over time
- Contributed memory usage: benchmarks over time
- Can uBO crash a browser?
- Tools, tests
- Deploying uBlock Origin
- Proposal for integration/unit testing
- uBlock Origin Core (Node.js):
- Troubleshooting:
- Good external guides:
- Scientific papers