Userscript Manager Detection

A Code Snippet for detecting if the script is being ran in an Userscript Manager.

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/453189/1106477/Userscript%20Manager%20Detection.js

作者
Taureon
版本
1
创建于
2022-10-16
更新于
2022-10-18
大小
787 字节
许可证
Unlicense

A Code Snippet for detecting if the script is being ran in an Userscript Manager. Made by Taureon.

How to use:

  • Add var isInUserscriptContext = typeof GM === 'object' || typeof GM_info === 'object'; to the beginning of your script.
  • Get isInUserscriptContext anytime when required.