[Skip to main content](https://adguard.com/kb/general/extensions/#docusaurus_skipToContent_fallback)
[![AdGuard](https://adguard.com/kb/img/logo.svg)](https://adguard.com/kb/)[Docs](https://adguard.com/kb/)[Blog](https://adguard.com/blog/index.html)[Official website](https://adguard.com)
[](https://adguard.com/kb/general/extensions/)
  * [English](https://adguard.com/kb/general/extensions/)
  * [Русский](https://adguard.com/kb/ru/general/extensions/)
  * [Deutsch](https://adguard.com/kb/de/general/extensions/)
  * [Čeština](https://adguard.com/kb/cs/general/extensions/)
  * [Français](https://adguard.com/kb/fr/general/extensions/)
  * [Español](https://adguard.com/kb/es/general/extensions/)
  * [Italiano](https://adguard.com/kb/it/general/extensions/)
  * [Português (Brasil)](https://adguard.com/kb/pt-BR/general/extensions/)
  * [日本語](https://adguard.com/kb/ja/general/extensions/)
  * [한국어](https://adguard.com/kb/ko/general/extensions/)
  * [中文（中国）](https://adguard.com/kb/zh-CN/general/extensions/)
  * [中文（台灣）](https://adguard.com/kb/zh-TW/general/extensions/)
  * [Help Us Translate](https://adguard.com/kb/miscellaneous/contribute/translate/program/)


[GitHub](https://github.com/AdguardTeam/KnowledgeBase)
Search`K`
[![AdGuard](https://adguard.com/kb/img/logo.svg)](https://adguard.com/kb/)
  * [Overview](https://adguard.com/kb/)
  * [General](https://adguard.com/kb/general/extensions/)
    * [Ad filtering](https://adguard.com/kb/general/extensions/)
    * [HTTPS filtering](https://adguard.com/kb/general/extensions/)
    * [Phishing and malware protection](https://adguard.com/kb/general/browsing-security/)
    * [Tracking protection (formerly Stealth Mode)](https://adguard.com/kb/general/stealth-mode/)
    * [AdGuard account](https://adguard.com/kb/general/extensions/)
    * [Extensions](https://adguard.com/kb/general/extensions/)
    * [License](https://adguard.com/kb/general/extensions/)
    * [How to install AdGuard](https://adguard.com/kb/general/how-to-install/)
  * [AdGuard for Windows](https://adguard.com/kb/adguard-for-windows/)
  * [AdGuard for Windows v8](https://adguard.com/kb/adguard-for-windows-8/)
  * [AdGuard for Mac](https://adguard.com/kb/adguard-for-mac/)
  * [AdGuard for Android](https://adguard.com/kb/adguard-for-android/)
  * [AdGuard for iOS](https://adguard.com/kb/adguard-for-ios/)
  * [AdGuard Browser Extension](https://adguard.com/kb/adguard-browser-extension/)
  * [AdGuard for Safari](https://adguard.com/kb/adguard-for-safari/)
  * [AdGuard Mini for Mac](https://adguard.com/kb/adguard-mini-for-mac/)
  * [AdGuard Content Blocker](https://adguard.com/kb/adguard-content-blocker/)
  * [AdGuard for Linux](https://adguard.com/kb/adguard-for-linux/)
  * [Miscellaneous](https://adguard.com/kb/general/extensions/)
  * [Guides](https://adguard.com/kb/general/extensions/)


  * [](https://adguard.com/kb/)
  * General
  * Extensions


On this page
# Extensions
## Userscripts[​](https://adguard.com/kb/general/extensions/#userscripts "Direct link to heading")
Userscripts (we also call them "extensions") are, de facto, miniprograms written in JavaScript. They modify or extend the functionality of one or more websites. Many AdGuard users may be already familiar with such userscripts as AdGuard Assistant, Popup Blocker, and AdGuard Extra.
AdGuard can significantly broaden website functionality by acting as a userscript manager. You can add your custom scripts or manage the existing ones in our three products: [AdGuard for Windows](https://adguard.com/kb/adguard-for-windows/features/extensions/), [AdGuard for Android](https://adguard.com/kb/adguard-for-android/features/settings/#userscripts), and [AdGuard for Mac](https://adguard.com/kb/adguard-for-mac/features/extensions/).
### Recommended AdGuard scripts[​](https://adguard.com/kb/general/extensions/#recommended-adguard-scripts "Direct link to heading")
These userscripts come directly from the AdGuard developers, and we can guarantee that they are effective and safe. For some of the userscripts developed by others that we consider good and reliable, [scroll down to the next section](https://adguard.com/kb/general/extensions/#top-picks). You can also find some of the [popular websites with scripts](https://adguard.com/kb/general/extensions/#more-userscripts) below, but remember that whenever you download a userscript from an unknown source, you are exposing yourself to a certain risk, as some scripts may be harmful to your computer.
#### AdGuard Extra[​](https://adguard.com/kb/general/extensions/#adguard-extra "Direct link to heading")
An extension that blocks ads in difficult cases when the usual filter-based approach is not enough. AdGuard Extra comes pre-installed in AdGuard standalone apps, except for the one for iOS, so you don't need to do anything to enable it. However, if you want to use it alongside AdGuard Browser Extension or any other ad blocker, you'll need to use an additional extension. Learn more about this userscript and how to install it on [GitHub](https://github.com/AdguardTeam/AdGuardExtra).
![AdGuard Extra](https://cdn.adtidy.org/content/kb/ad_blocker/general/adguard-extra.png)
#### AdGuard Popup Blocker[​](https://adguard.com/kb/general/extensions/#adguard-popup-blocker "Direct link to heading")
The name speaks for itself: it blocks popups — one of the most annoying types of ads on websites. Learn more about this userscript, its key features, and installation on [GitHub](https://github.com/AdguardTeam/PopupBlocker).
![AdGuard Popup Blocker](https://cdn.adtidy.org/content/kb/ad_blocker/general/popup-blocker-installation.png)
#### AdGuard Assistant (legacy version)[​](https://adguard.com/kb/general/extensions/#adguard-assistant-legacy-version "Direct link to heading")
This custom extension is designed to control filtering directly from the browser page (manual blocking, allowlisting, etc.).
This version of Assistant is legacy and there is no point in using it on new systems, as it has been replaced with the full-fledged [Browser Assistant](https://adguard.com/adguard-assistant/overview.html). However, the legacy Assistant may be useful if there is no Browser Assistant for your browser. If this is your case, you can learn how to install AdGuard Assistant on [GitHub](https://github.com/AdguardTeam/AdguardAssistant).
#### Disable AMP[​](https://adguard.com/kb/general/extensions/#disable-amp "Direct link to heading")
A script that is only pre-installed in AdGuard for Android. It disables AMP (Accelerated Mobile Pages) on the Google search results page. Learn more about this userscript and how to install it on [GitHub](https://github.com/AdguardTeam/DisableAMP).
![Disable AMP](https://cdn.adtidy.org/content/kb/ad_blocker/general/disable-amp-installation.png)
### Top picks outside AdGuard[​](https://adguard.com/kb/general/extensions/#top-picks "Direct link to heading")
These userscripts are not developed by AdGuard, and therefore we can't give a 100% guarantee that they are safe and/or work at all times. However, in our experience they deserve a recommendation because they've all earned their good reputation.
#### Don't track me Google[​](https://adguard.com/kb/general/extensions/#dont-track-me-google "Direct link to heading")
This script removes Google's tracking feature from the links in Google search results. It speeds up the loading of search results and allows you to right-click or tap to copy the link URL.
Its source code is [available on GitHub](https://github.com/Rob--W/dont-track-me-google). This userscript can be downloaded from [GreasyFork](https://greasyfork.org/en/scripts/428243-don-t-track-me-google) and installed in any AdGuard CoreLibs-based app.
#### SponsorBlock[​](https://adguard.com/kb/general/extensions/#sponsorblock "Direct link to heading")
SponsorBlock skips sponsored segments in YouTube videos. It saves time by jumping straight to the main content and removes interruptions from ads and self-promotions.
This userscript runs exclusively on our desktop applications, AdGuard for Windows and AdGuard for Mac.
To try it out:
  1. Go to <https://mchangrh.github.io/sb.js/>.
  2. Click **Generate link**.
  3. Copy the link that appears.
  4. Open AdGuard and go to **Extensions → Add extension → Import from file or URL**.
  5. Paste the copied link and confirm.


#### tinyShield[​](https://adguard.com/kb/general/extensions/#tinyshield "Direct link to heading")
A userscript for people visiting Korean websites and some international websites. The tinyShield userscript blocks Ad-Shield ads and anti-adblocks. This userscript can be installed in AdGuard CoreLibs-based apps, Violentmonkey, Tampermonkey, and [quoid/userscripts](https://github.com/quoid/userscripts). Learn more about tinyShield and how to install it on [GitHub](https://github.com/List-KR/tinyShield).
### Where can you get more userscripts?[​](https://adguard.com/kb/general/extensions/#more-userscripts "Direct link to heading")
Since userscripts are mainly created by enthusiasts, you should be cautious when installing them. Any script from an unknown source carries a potential risk. Yet, there is a great variety of interesting scripts that, if installed carefully and responsibly, can really make using some websites more convenient.
Here we will describe some of the most popular userscript catalogs.
#### Userscript.Zone[​](https://adguard.com/kb/general/extensions/#userscriptzone "Direct link to heading")
[Userscript.Zone](https://www.userscript.zone) is a website that allows searching for userscripts by entering a matching URL or domain. The website is easy to use and has a high level of credibility as only scripts from moderated pages are displayed.
#### Greasy Fork[​](https://adguard.com/kb/general/extensions/#greasy-fork "Direct link to heading")
[Greasy Fork](https://greasyfork.org/) is a userscript catalog of Stylish creators. The scripts in this catalog are moderated, so their credibility is much higher.
#### OpenUserJS.org[​](https://adguard.com/kb/general/extensions/#openuserjsorg "Direct link to heading")
[OpenUserJS.org](https://openuserjs.org/) is an open-source userscript catalog written in nodeJS. It's not moderated, so keep an eye out for suspicious scripts.
#### Community[​](https://adguard.com/kb/general/extensions/#community "Direct link to heading")
If you like the idea of customizing your browser with userscripts and have questions, you can ask them on one of these websites:
  * [Stackoverflow](https://stackoverflow.com/questions/tagged/userscripts)
  * [FreeNode](https://webchat.freenode.net/#greasemonkey)
  * [Reddit](https://www.reddit.com/r/userscripts/)


### Development[​](https://adguard.com/kb/general/extensions/#development "Direct link to heading")
#### Request license[​](https://adguard.com/kb/general/extensions/#request-license "Direct link to heading")
If you are developing your own userscript and want to test how it works with AdGuard, you can request a license by filling in [the form](https://surveys.adguard.com/en/for_developers_request/form.html).
#### Compatibility[​](https://adguard.com/kb/general/extensions/#compatibility "Direct link to heading")
##### Metadata block[​](https://adguard.com/kb/general/extensions/#metadata-block "Direct link to heading")
###### Supported properties[​](https://adguard.com/kb/general/extensions/#supported-properties "Direct link to heading")
  * [`@name`](https://wiki.greasespot.net/Metadata_Block#@name)
  * [`@namespace`](https://wiki.greasespot.net/Metadata_Block#@namespace)
  * [`@description`](https://wiki.greasespot.net/Metadata_Block#@description)
  * [`@version`](https://wiki.greasespot.net/Metadata_Block#@version)
  * [`@match`](https://wiki.greasespot.net/Metadata_Block#@match)
  * [`@include`](https://wiki.greasespot.net/Metadata_Block#@include)
  * [`@exclude`](https://wiki.greasespot.net/Metadata_Block#@exclude)
  * [`@grant`](https://wiki.greasespot.net/Metadata_Block#@grant)
  * [`@connect`](https://www.tampermonkey.net/documentation.php#meta:connect)
  * [`@require`](https://wiki.greasespot.net/Metadata_Block#@require)
  * [`@resource`](https://wiki.greasespot.net/Metadata_Block#@resource)
  * [`@downloadURL`](https://www.tampermonkey.net/documentation.php#meta:downloadURL)
  * [`@updateURL`](https://www.tampermonkey.net/documentation.php#meta:updateURL)
  * [`@homepage`, `@homepageURL`, `@source`, `@website`](https://www.tampermonkey.net/documentation.php#meta:homepage)
  * [`@run-at`](https://wiki.greasespot.net/Metadata_Block#@run-at)
  * [`@noframes`](https://wiki.greasespot.net/Metadata_Block#@noframes)
  * [`@icon`, `@iconURL`, `@defaulticon`](https://www.tampermonkey.net/documentation.php#meta:icon)
  * [`@icon64`, `@icon64URL`](https://www.tampermonkey.net/documentation.php#meta:icon64)


###### Unsupported properties[​](https://adguard.com/kb/general/extensions/#unsupported-properties "Direct link to heading")
These properties will be simply ignored by AdGuard.
  * [`@unwrap`](https://www.tampermonkey.net/documentation.php#meta:unwrap)


##### Supported GM functions[​](https://adguard.com/kb/general/extensions/#supported-gm-functions "Direct link to heading")
AdGuard supports both old GM_ functions and new GM4 API that use GM object.
All listed old Greasemonkey functions are deprecated but still supported.
  * [`GM.info`, `GM_info`](https://wiki.greasespot.net/GM.info)
  * [`GM.setValue`, `GM_setValue`](https://wiki.greasespot.net/GM.setValue)
  * [`GM.getValue`, `GM_getValue`](https://wiki.greasespot.net/GM.getValue)
  * [`GM.listValues`, `GM_listValues`](https://wiki.greasespot.net/GM.listValues)
  * [`GM.deleteValue`, `GM_deleteValue`](https://wiki.greasespot.net/GM.deleteValue)
  * [`GM.getResourceUrl`, `GM_getResourceURL`](https://wiki.greasespot.net/GM.getResourceUrl)
  * [`GM.setClipboard`, `GM_setClipboard`](https://wiki.greasespot.net/GM.setClipboard)
  * [`GM.xmlHttpRequest`, `GM_xmlhttpRequest`](https://wiki.greasespot.net/GM.xmlHttpRequest)
  * [`GM.openInTab`, `GM_openInTab`](https://wiki.greasespot.net/GM.openInTab)
  * [`GM.notification`](https://wiki.greasespot.net/GM.notification)
  * [`unsafeWindow`](https://wiki.greasespot.net/UnsafeWindow)
  * [`GM_getResourceText`](https://www.tampermonkey.net/documentation.php#api:GM_getResourceText)
  * [`GM_addStyle`](https://www.tampermonkey.net/documentation.php#api:GM_addStyle)
  * [`GM_log`](https://www.tampermonkey.net/documentation.php#api:GM_log)
  * [`GM.addElement`, `GM_addElement`](https://www.tampermonkey.net/documentation.php#api:GM_addElement)
  * [`window.onurlchange`](https://www.tampermonkey.net/documentation.php#api:window.onurlchange)


You can find more information about Greasemonkey API in [its manual](https://wiki.greasespot.net/Greasemonkey_Manual:API).
#### Example[​](https://adguard.com/kb/general/extensions/#example "Direct link to heading")
```
// ==UserScript==
// @name            Name as shown to the user when locale is english or unknown
// @name:ru         Name as shown to the user when locale is russian
// @description     Description as shown to the user when locale is english or unknown
// @description:ru  Description as shown to the user when locale is russian
// @icon            https://myhomepage.com/myuserscript.png
// @version         1.0.0.0
// @downloadURL     https://dl.myhomepage.org/myuserscript.user.js
// @updateURL       https://dl.myhomepage.org/myuserscript.meta.js
// @homepageURL     https://myhomepage.com/myuserscript
// @include         *
// @exclude         *://website.com/*
// @resource        https://myhomepage.com/myuserscript.css
// @require         https://myhomepage.com/mylibrary.js
// @grant           property:settings
// @grant           GM_getValue
// @grant           GM_setValue
// @grant           GM_deleteValue
// @grant           GM_listValues
// @grant           GM_getResourceText
// @grant           GM_getResourceURL
// @grant           GM_addStyle
// @grant           GM_log
// @grant           GM_setClipboard
// @grant           GM_xmlhttpRequest
// @grant           unsafeWindow
// @grant           GM_info
// @grant           GM_openInTab
// @grant           GM_registerMenuCommand
// @grant           GM_addElement
// @grant           window.onurlchange
// @run-at          document-start
// ==/UserScript==
!function(){(
    console.log("I am loaded!");
)}();

```

#### Trusted Types API[​](https://adguard.com/kb/general/extensions/#trusted-types-api "Direct link to heading")
AdGuard provides an instance of the `PolicyApi` class that allows you to manage Trusted Types in your userscripts.
You can access the instance of this class by using the `ADG_policyApi` variable in your userscript.
##### Properties[​](https://adguard.com/kb/general/extensions/#properties "Direct link to heading")
  * `name: string` — a name of the policy (Default is `"AGPolicy"`).
  * `isSupported: boolean` — a flag indicating whether or not the Trusted Types API is supported by the current browser.


##### Polyfilled methods[​](https://adguard.com/kb/general/extensions/#polyfilled-methods "Direct link to heading")
  * [`ADG_policyApi.createHTML`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy/createHTML). If not supported, returns `input: string`.
  * [`ADG_policyApi.createScript`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy/createScript). If not supported, returns `input: string`.
  * [`ADG_policyApi.createScriptURL`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy/createScriptURL). If not supported, returns `input: string`.
  * [`ADG_policyApi.getAttributeType`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getAttributeType). If not supported, returns `null`.
  * [`ADG_policyApi.getPropertyType`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getPropertyType). If not supported, returns `null`.
  * [`ADG_policyApi.isHTML`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isHTML). If not supported, returns `false`.
  * [`ADG_policyApi.isScript`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isScript). If not supported, returns `false`.
  * [`ADG_policyApi.isScriptURL`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isScriptURL). If not supported, returns `false`.


##### Additional Types[​](https://adguard.com/kb/general/extensions/#additional-types "Direct link to heading")
```
/**
 * Enum representation of the return values of the `getAttributeType` and
 * `getPropertyType` methods of the native Trusted Types API.
 *
 * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getAttributeType}
 * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getPropertyType}
 */
enum TrustedType {
    HTML = 'TrustedHTML',
    Script = 'TrustedScript',
    ScriptURL = 'TrustedScriptURL',
}

// You can access it like that inside of userscript
ADG_TrustedType.HTML // "TrustedHTML"

/**
 * Isomorphic trusted value type. If a browser supports the Trusted Types API, it will be one of the enum Trusted Types
 * (`TrustedHTML`, `TrustedScript` or `TrustedScriptURL`); otherwise, it will be regular `string`.
 *
 * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedHTML}
 * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedScript}
 * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedScriptURL}
 */
type TrustedValue = string | TrustedHTML | TrustedScript | TrustedScriptURL;

```

##### Additional methods[​](https://adguard.com/kb/general/extensions/#additional-methods "Direct link to heading")
```
/**
 * Creates a Trusted Type depending on `type`:
 * - `TrustedHTML`
 * - `TrustedScript`
 * - `TrustedScriptURL`
 * - or returns `value` if none of them is applicable.
 *
 * @param type          Trusted Type.
 * @param value         Value from which a Trusted Type is created.
 * @param createArgs    Additional arguments to be passed to the function represented by `TrustedTypePolicy`.
 * @returns             Created value.
 */
function create(
    type: TrustedType,
    value: string,
    ...createArgs: unknown[]
): TrustedValue


// Example: Creates TrustedHTML
const trustedHTML = ADG_policyApi.create(ADG_TrustedType.HTML, '<div></div>');

/**
 * Converts `value` of `attribute` into one of the Trusted Types:
 * - `TrustedHTML`
 * - `TrustedScript`
 * - `TrustedScriptURL`
 * - or returns `value` if none of them is applicable.
 *
 * @param tagName       Name of an HTML tag.
 * @param attribute     Attribute.
 * @param value         Value of an attribute to be converted.
 * @param elementNS     Element namespace. If empty, defaults to the HTML namespace.
 * @param attrNS        Attribute namespace. If empty, defaults to null.
 * @param createArgs    Additional arguments to be passed to the function represented by `TrustedTypePolicy`.
 * @returns             Converted value.
 */
function convertAttributeToTrusted(
    tagName: string,
    attribute: string,
    value: string,
    elementNS?: string,
    attrNS?: string,
    ...createArgs: unknown[]
): TrustedValue

// Example: Converts to TrustedScriptURL
const trustedScriptURL = ADG_policyApi.convertAttributeToTrusted("script", "src", 'SOME_URL');
scriptElement.setAttribute("src", trustedScriptURL);

/**
 * Converts `value` of `property` into one of the Trusted Types:
 * - `TrustedHTML`
 * - `TrustedScript`
 * - `TrustedScriptURL`
 * - or returns `value` if none of them is applicable.
 *
 * @param tagName       Name of an HTML tag.
 * @param property      Property.
 * @param value         Value of a property to be converted.
 * @param elementNS     Element namespace. If empty, defaults to the HTML namespace.
 * @param createArgs    Additional arguments to be passed to the function represented by `TrustedTypePolicy`.
 * @returns             Converted value.
 */
function convertPropertyToTrusted(
    tagName: string,
    property: string,
    value: string,
    elementNS?: string,
    ...createArgs: unknown[]
): TrustedValue

// Example: Converts to TrustedHTML
divElement.innerHTML = ADG_policyApi.convertPropertyToTrusted("div", "innerHTML", "<div></div>");

```

#### Matching SPA sites[​](https://adguard.com/kb/general/extensions/#matching-spa-sites "Direct link to heading")
This section only applies to AdGuard for Windows, AdGuard for Mac, AdGuard for Android, and AdGuard for Linux with [CoreLibs](https://github.com/AdguardTeam/CoreLibs) v1.19 or later.
Many modern websites, such as YouTube, utilize [Single Page Application (SPA)](https://en.wikipedia.org/wiki/Single-page_application) capabilities. Unlike traditional web applications, the page does not reload when navigating between pages. Instead, the content is updated dynamically using JavaScript, allowing for a smoother user experience.
On such websites, a userscript is invoked only once when the `@match` or `@include` directives are matched (unless `@exclude` is matched). Due to the nature of SPAs, the userscript cannot be re-invoked on subsequent page changes because the global JavaScript context remains the same. To address this issue, userscripts can use the `@grant window.onurlchange` directive.
```
// ==UserScript==
// @name SPA
// @namespace spa
// @version 1.0.0
// @match https://*/*
// @grant window.onurlchange
// @run-at document-start
// ==/UserScript==

// via window.onurlchange
window.onurlchange = (event) => {
    console.log('URL changed to:', event.url);
};

// via window.addEventListener('urlchange')
window.addEventListener('urlchange', (event) => {
    console.log('URL changed to:', event.url);
});

```

This will allow userscripts to listen for URL changes and handle them accordingly.
The `urlchange` event is only triggered for full URL changes, such as a change in the path or query, but not for fragment (hash) changes. Examples:
  * Navigation from `https://example.com/page1` to `https://example.com/page2` will trigger the event.
  * Navigation from `https://example.com/page1?query=1` to `https://example.com/page1?query=2` will trigger the event.
  * Navigation from `https://example.com/page1#section1` to `https://example.com/page1#section2` will **NOT** trigger the event.


The `window.onurlchange` and `window.addEventListener('urlchange', ...)` APIs are non-standard. To use them, you must explicitly grant them in your userscript with `@grant window.onurlchange`.
If a website uses hash routing, userscripts can use the native DOM [`hashchange` event](https://developer.mozilla.org/en-US/docs/Web/API/Window/hashchange_event):
```
// ==UserScript==
// @name SPA
// @namespace spa
// @version 1.0.0
// @match https://*/*
// @run-at document-start
// ==/UserScript==

// via window.onhashchange
window.onhashchange = (event) => {
    console.log(`Hash changed from "${event.oldURL}" to "${event.newURL}"`);
};

// via window.addEventListener('hashchange')
window.addEventListener('hashchange', (event) => {
    console.log(`Hash changed from "${event.oldURL}" to "${event.newURL}"`);
});

```

## Userstyles[​](https://adguard.com/kb/general/extensions/#userstyles "Direct link to heading")
Userstyles allow users to change the appearance of popular websites.
AdGuard has the option to upload or create your own userstyles. This is an advanced feature, so you will need some knowledge of HTML and CSS.
Currently, two AdGuard apps allow you to create and manage userstyles: AdGuard for Windows (v7.19 or later) and AdGuard for Mac (v2.16 or later). We also plan to implement this new feature in AdGuard for Android v4.8 in the nearest future.
This is an experimental feature, so if you encounter any problems while adding or creating a userstyle, please contact our support team at support@adguard.com.
### How to set up a userstyle in AdGuard[​](https://adguard.com/kb/general/extensions/#how-to-set-up-a-userstyle-in-adguard "Direct link to heading")
You can download userstyles from various websites. One of the most popular userstyle websites is [https://userstyles.world/](https://userstyles.world/explore), which we will use as an example for the following instructions on how to set up the userstyle in AdGuard.
  1. Follow the link above and choose the userstyle you like
  2. Click _Copy_ next to the userstyle address
  3. Open AdGuard settings → _Extensions_
  4. Press the [+] button and paste the userstyle link
  5. Done!


If you’re familiar with CSS rules, you can also create userstyles yourself.
We don’t support userstyles that contain `@var` or `@advanced` in the metadata. AdGuard also doesn’t support `@preprocessor` without the `default` value.
  1. Open AdGuard settings → _Extensions_
  2. Press the [+] button and choose the _Create userstyle_ option. A new window will appear on your screen
  3. To create a userstyle, first write the title with metadata, for example
```
/* ==UserStyle==
@name New userstyle
@version 1.0
==/UserStyle== */

```

  4. Write the CSS part after the meta data. AdGuard supports website domain names matching (`@-moz-document domain(…), …`). For example:
```
body {
  background: gray;
  }

```

Or:
```
@-moz-document domain('example.org'),
domain('example.net'),
domain('example.com') body {
  background: gray;
  }

```

  5. Once you’re finished, press _Save and Close_. Your new userstyle has been successfully added to AdGuard


### Example[​](https://adguard.com/kb/general/extensions/#example-1 "Direct link to heading")
```
/* ==UserStyle==
@name         Example userstyle
@namespace    https://example.org/userstyle
@homepageURL  https://example.org/userstyle
@version      1.0.0
@license      Other
@description  This is an example
@author       example
@preprocessor default
==/UserStyle== */
@-moz-document regexp("https?\:\/\/(www\.)?example\.(org|com).*") {
    body {
        background-color: #000000 !important;
    }
}

```

[](https://github.com/AdguardTeam/KnowledgeBase/edit/master/docs/general/extensions.md)
[Previous Two-factor authentication](https://adguard.com/kb/general/account/2fa/)[Next What is an AdGuard license?](https://adguard.com/kb/general/license/what-is/)
  * [Userscripts](https://adguard.com/kb/general/extensions/#userscripts)
    * [Recommended AdGuard scripts](https://adguard.com/kb/general/extensions/#recommended-adguard-scripts)
    * [Top picks outside AdGuard](https://adguard.com/kb/general/extensions/#top-picks)
    * [Where can you get more userscripts?](https://adguard.com/kb/general/extensions/#more-userscripts)
    * [Development](https://adguard.com/kb/general/extensions/#development)
  * [Userstyles](https://adguard.com/kb/general/extensions/#userstyles)
    * [How to set up a userstyle in AdGuard](https://adguard.com/kb/general/extensions/#how-to-set-up-a-userstyle-in-adguard)
    * [Example](https://adguard.com/kb/general/extensions/#example-1)


AdGuard
  * [Official website](https://adguard.com)
  * [About](https://adguard.com/contacts.html)
  * [Blog](https://adguard.com/blog/index.html)
  * [Discuss](https://adguard.com/discuss.html)
  * [Support AdGuard](https://adguard.com/support-adguard.html)


Products
  * [For Windows](https://adguard.com/adguard-windows/overview.html)
  * [For Mac](https://adguard.com/adguard-mac/overview.html)
  * [For Android](https://adguard.com/adguard-android/overview.html)
  * [For Android TV](https://adguard.com/adguard-android-tv/overview.html)
  * [For iOS](https://adguard.com/adguard-ios/overview.html)
  * [For browsers](https://adguard.com/adguard-browser-extension/overview.html)
  * [Version history](https://adguard.com/versions.html)


Support
  * [Support Center](https://adguard.com/support.html)
  * [How to create your own ad filter](https://adguard.com/kb/general/ad-filtering/create-own-filters/)
  * [AdGuard Ad Filters](https://adguard.com/kb/general/ad-filtering/adguard-filters/)
  * [Removal Instructions](https://adguard.com/removal.html)
  * [Userscripts](https://adguard.com/kb/general/extensions/)
  * [FAQ](https://adguard.com/support/faq.html)
  * [AdGuard status](https://status.adguard.com/)
  * [AdGuard diagnostics](https://adguard.com/test.html)


License
  * [Purchase License](https://adguard.com/license.html)
  * [Recover License](https://adguard.com/kb/general/license/what-is/)
  * [Terms of sale](https://adguard.com/terms-of-sale.html)
  * [Get Free License](https://adguard.com/get-adguard-for-free.html)
  * [Distribution](https://adguard.com/partners.html)


![AdGuard](https://adguard.com/kb/img/logo_dark.svg)
© 2009–2026 Adguard Software Ltd.
