Understand the snippets library
Snippets are pieces of JavaScript code, injected by the SDK, that execute within the context of a website and combat advanced ads that circumvent ordinary blocking.
A snippet is typically a JavaScript function. It may optionally take arguments.
Snippets are stored in a snippet library and selected for execution based on the content of a filter list. The filter list also specifies any arguments passed to snippets on a given website.
Multiple snippets with various arguments may be executed on a single website. For more on snippet functionality, view the Snippets Overview.
In order to execute snippets on websites, the following are required:
- the snippet library of a sufficiently recent version must be built into the browser
The Anti-CV filter list is subscribed by default.
If it isn't in your configuration, you can subscribe to it the same way as you subscribe to any other filter list, through
AdblockController
or any of the platform-specific APIs.The snippet library may sometimes be updated separately from the remainder of the SDK by changing the tagged version.
Some changes to the snippets library may require alignment of the SDK. Consult the following compatibility matrix to see if an SDK version is compatible with a snippet library version:
snippet library version | required SDK version |
---|---|
0.5.1 | 105+ |
- 1.
- 2.Run
gclient sync
to pull the new version of the library to your local repository. - 3.Rebuild the browser (
ninja -C out/...
)
Remember to consult the compatibility matrix to avoid mismatches between the snippets library content and the SDK's expectations.
Last modified 26d ago