User scripts are small, flexible and easy to use, and can be used to extend the browser functionality very easily. Some regular browser functions can be implemented in the form of user scripts, such as reading mode, page translation, night mode, etc.
Based on the characteristics of user scripts we can broadly classify user scripts into two categories, which we call normal user scripts and Greasemonkey scripts
Here is the simplest normal user script
Greasemonkey originated as an extension on FireFox and later appeared Tampermonkey with wider support and better compatibility. We call scripts compatible with these two extensions collectively called Greasemonkey scripts
The following is the simplest GreaseMonkey script
Compared to normal scripts, we find that Grease Monkey scripts contain two parts, one is the file header consisting of metadata, and the other is the code body. The metadata tags define some information related to the script, such as version, name, third-party library dependencies, resource dependencies, execution permissions, and other information. In addition, the script manager also provides some advanced APIs to help developers achieve more efficient and convenient development. More information about metadata and APIs will be introduced in the User script API Reference.