Tampermonkey Script API Example

In order to let you better understand how to use Tampermonkey script API , we provide a Tampermonkey Script API Example, the example contains most of the GM function usage, by running the example and combined with the script code to help us quickly understand the usage of Tampermonkey script API.

Below we describe the steps to install and run the example scripts in XBrowser and Chrome respectively.

Run the script in XBrowser

  1. Make sure the XBrowser version is 3.7.8 and above, you can open here directly in XBrowser to install it directly.


  1. Open the https://www.example.com to prepare for the test.

The page you see after the script runs successfully looks like this.


  1. At the same time, several options will be added to the browser’s page tools menu, and each option corresponds to the corresponding Tampermonkey Script API method example.


Run the script in Chrome

  1. We assume that you already have the Tampermonkey extension installed in Chrome, open the admin panel, switch to the Utilities tab. Select “Install from URL”.

  2. After the script is successfully installed, open the URL https://www.example.com

After the script runs successfully, you will see a page that looks like this


  1. Click on the Tampermonkey extension button to see the menu options for the example script