Resources Library
- Current RAW version of Resources can be found in files inside src/js/resources/ directory ↪ and src/web_accessible_resources directory ↪
- General purpose scriptlets
- Defuser scriptlets
- Empty redirect resources
- URL-specific sanitized redirect resources
- Other (deprecated/outdated)
- Scriptlets and Redirects compatibility tables between uBlock Origin / AdGuard / Adblock Plus
- Glossary
Available general purpose scriptlets
- abort-current-script (acs / abort-current-inline-script / acis)
- abort-on-property-read (aopr)
- abort-on-property-write (aopw)
- abort-on-stack-trace (aost)
- addEventListener-defuser (aeld / prevent-addEventListener)
- ~addEventListener-logger~ (~aell~)
- trusted-click-element [Trusted]
- set-constant (set)
- trusted-set-constant (trusted-set) [Trusted]
- trusted-suppress-native-method [Trusted]
- trusted-override-element-method [Trusted]
- trusted-prevent-dom-bypass [Trusted]
- set-cookie
- set-cookie-reload
- trusted-set-cookie [Trusted]
- trusted-set-cookie-reload [Trusted]
- remove-cookie (cookie-remover)
- set-local-storage-item / set-session-storage-item
- trusted-set-local-storage-item / trusted-set-session-storage-item [Trusted]
- call-nothrow
- prevent-setInterval (no-setInterval-if / nosiif / setInterval-defuser)
- prevent-setTimeout (no-setTimeout-if / nostif / setTimeout-defuser)
- adjust-setInterval (nano-setInterval-booster / nano-sib)
- adjust-setTimeout (nano-setTimeout-booster / nano-stb)
- trusted-create-HTML [Trusted]
- prevent-innerHTML
- prevent-xhr (no-xhr-if)
- trusted-prevent-xhr [Trusted]
- prevent-fetch (no-fetch-if)
- trusted-prevent-fetch [Trusted]
- trusted-replace-xhr-response [Trusted]
- trusted-replace-fetch-response (trusted-rpfr) [Trusted]
- trusted-replace-argument [Trusted]
- set-attr
- trusted-set-attr [Trusted]
- remove-attr (ra)
- remove-class (rc)
- remove-node-text (rmnt)
- trusted-replace-node-text (trusted-rpnt / replace-node-text / rpnt) [Trusted]
- trusted-replace-outbound-text (trusted-rpot) [Trusted]
- spoof-css
- prevent-canvas
- prevent-dialog
- href-sanitizer
- disable-newtab-links
- close-window (window-close-if)
- prevent-window-open (nowoif / no-window-open-if / window.open-defuser)
- trusted-prune-inbound-object [Trusted]
- trusted-prune-outbound-object [Trusted]
- json-prune
- json-prune-fetch-response
- json-prune-xhr-response
- evaldata-prune
- xml-prune
- m3u-prune
- noeval
- noeval-silent
- noeval-if (prevent-eval-if)
- ~no-floc~
- prevent-requestAnimationFrame (no-requestAnimationFrame-if / norafif)
- nowebrtc
- webrtc-if
- window.name-defuser
- prevent-refresh (refresh-defuser)
- overlay-buster
- alert-buster
edit-suite-of-scriptlets- json-edit
- json-edit-xhr-response
- json-edit-xhr-request
- json-edit-fetch-response
- json-edit-fetch-request
Available defuser scriptlets
- ampproject_v0
- fingerprint2
- fingerprint3
- nobab <sup>(BlockAdblock)</sup>
- nobab2 <sup>(BlockAdblock 4.2b)</sup>
- nofab <sup>(FuckAdblock)</sup>
- popads-dummy
- popads
- prebid-ads
Available empty redirect resources
1x1.gif2x2.png3x2.png32x32.pngnoop.cssnoop.html(noopframe)noop.jsnoop.json<sup>1.53.5rc11</sup>noop.txtnoop-0.1s.mp3noop-0.5s.mp3noop-1s.mp4noop-vast2.xml<sup>1.59.1b6</sup>noop-vast3.xml<sup>1.59.1b6</sup>noop-vast4.xml<sup>1.59.1b6</sup>noop-vmap1.xml<sup>1.33</sup>noneclick2load.html
Available URL-specific sanitized redirect resources (surrogates)
- amazon_ads.js
- amazon_apstag.js
- doubleclick_instream_ad_status
- google-analytics_ga.js
- google-analytics_analytics.js
- google-analytics_inpage_linkid.js
- google-analytics_cx_api.js
- google-ima.js
- googletagservices_gpt.js
- googletagmanager_gtm.js
- googlesyndication_adsbygoogle.js
- scorecardresearch_beacon.js
- outbrain-widget.js
- hd-main.js
General purpose scriptlets
- Most scriptlet relies on
Objectproperties (methods), altering them may not be the best idea (you should know what you are doing). - Some properties related more to browser APIs rather than JS language built-ins can behave in unexpected way. For example browser can override them without scriptlet noticing this. Keep this in mind when using them in scriptlet injection filers.
- "Optional" for "string/regular expression" parameter defaults to "catch all" (
/.?/) if not specified. - "String" parameter means plain character(s)/word(s), quotes will be taken literally, commas must be escaped in regex literals:
/foo\x2cbar\u002cbaz/, after 1.22.0 commas can be escaped by backslash character (foo\,bar). - "Regular expression" parameter means JavaScript regular expression literal.
- Mime type is
application/javascriptif not present. - You can use the short alias form when available for scriptlet name.
- You should omit the
.jsfrom the scriptlet name in scriptlet injection filters (eventually in some future this will be the official way to do this).- Do not skip
.jswhen the scriptlet is used withredirect=, only when used in+js(...).
- Do not skip
- Crossed out resources are deprecated/removed.
- Starting with 1.46.1b17 support for regex-based values as target domain has been added. Use sparingly, when no other solution is practical from a maintenance point of view -- keeping in mind that uBO has to iterate through all the regex-based values, unlike plain hostname or entity-based values which are mere lookups. Related discussion: uBlockOrigin/uBlock-issues#2234. Example:
/img[a-z]{3,5}\.buzz/##+js(nowoif). - The usage of named arguments is optional, positional arguments are still supported as documented. Named arguments is required to use "log" and/or "debug" arguments.
- The logging/debugging capabilities work only in the dev build of uBO or if the advanced setting
filterAuthorModeis set totrue. - Starting with 1.57.3b1, the old method of displaying scriptlets's logs in browser's dev console and via
(log, 1)tokens is deprecated: - now all scriptlets's logging output is automatically displayed in the logger & the logger's console pane.
- in the logger, toggling labels
infoanderrorin filter input field can be used to reduce information displayed in the logger to informations and errors, including scriptlets, and with additionalnotoperator selected, the opposite effect can be achieved. - in the logger's console pane, toggling additionally verbose mode button, will cause console pane to print more logs from scriptlets.
- by default, scriptlets will print out only calls and informations related to their orders and targets,
to log all calls without defusing any of them, a scriptlet without parameters can be used, example:wikipedia.org##+js(aeld) - related discussions: uBlockOrigin/uAssets/discussions/17907 and uBlockOrigin/uBlock-issues/discussions/3096
- The only filter lists deemed from a "trusted source" are uBO-specific filter lists (i.e. "uBlock filters -- ..."). The user's own filters from "My filters" are trusted only if "Allow custom filters requiring trust" is checked or in the dev build of uBO. This behaviour can be overridden with the advanced setting
trustedListPrefixes. - Tokens are parameters which modify the behavior of a scriptlet, they must be used after the required and optional parameters.
abort-current-script.js ↪
acs.js /
abort-current-inline-script.js /
acis.js
Aborts execution of inline script (throws ReferenceError) when attempts to access specified property when text content or src attribute value (new in 1.37.0) of <script> element matches specified text or regular expression.
Note that acis.js and abort-current-inline-script.js aliases are deprecated and can be removed in the future.
Parameters:
- required, property (chain of properties joined by .) attached to window object accessed inside <script> tag we want to break
- optional, string/regular expression matching in <script> element content
- optional, new in 1.37.0, string/regular expression matching in the decoded value of the src attribute of the <script> tag, when the attribute content is not a remote network address, but the actual inline script URL-encoded or base64-endcoded as a data: URI
Examples:
- weristdeinfreund.de##+js(acis, Number.isNaN)
- tichyseinblick.de##+js(acis, Math, /\}\s*\(.*?\b(self|this|window)\b.*?\)/)
~~Starting with 1.48.5b4, you can use the logging abilites.~~ (deprecated)
(read about the new method of logging scriptlets)
Tokens:
- ~~log, 1~~: output useful information at the dev console. (deprecated)
- debug, 1: break at key locations in the scriptlet.
Also see:
- AdGuard abort-current-inline-script
abort-on-property-read.js ↪
aopr.js
Aborts execution of script (throws ReferenceError) when attempts to read specified property. Writes are ignored.
Parameters:
- required, property (chain of properties joined by .) attached to window object
Examples:
- tagesspiegel.de##+js(aopr, Notification)
Also see:
- AdGuard abort-on-property-read
abort-on-property-write.js ↪
aopw.js
Aborts execution of script (throws ReferenceError) when attempts to write specified property.
Parameters:
- required, property (chain of properties joined by .) attached to window object that will be overwritten
Examples:
- yggtorrent.*##+js(aopw, Fingerprint2)
Also see:
- AdGuard abort-on-property-write
abort-on-stack-trace.js ↪
aost.js
Experimental, under development
New in 1.29.3rc9
Aborts execution of script (throws ReferenceError) when attempts to access specified property when stack trace matches specified text or regular expression. <sub>Internal discussion</sub>
Parameters:
- required, property (chain of properties joined by .) to trap in order to launch the stack trace matching code, ex. Math.random
- optional, string/regular expression, the needle to match against the stack trace. If the empty string, only log. Prepend pattern with ! to test for unmatched patterns in stack trace <sup>(New in 1.51.1b6)</sup>
The scriptlet logs when there is a match. If verbose mode is enabled, it will log both matches/no matches.
Stack trace is normalized, but there still can be differences (Chromium vs Firefox) because of different format of stack trace.
There is a special string which can be used to match inline script context - inlineScript.
Though the stack trace is rendered in the console using new line to separate the stack trace lines, internally \t is used. The reason is to be more easily be able to create regex-based needle when using regex . character class.
The stack trace is prepended with stackDepth:... in order to allow to filter on stack depth, however higher depth values can likely differ between Chromium and Firefox.
Firefox often reports injectedScript, attempt has been made to convert entries in Chromium which seems to correspond to this, so that both browser families will report injectedScript.
The column value is normalized to 1, however there is too much discrepancy between browser families for that value to be of any use.
Filtering according to reported line numbers (...:1234:1), will not be reliable for inline scripts, since the line at which those inline scripts are located will vary from one page to another. It should be reliable for when the stack trace entry is for code in a JS file.
