If you upgrade to Greasemonkey 0.9.16 (just released), you can use the new GM_info
object .
You can add this to your example script above:
var myVersion = GM_info.script.version; console.log ('Version: ', myVersion, myVersion === "5.3.0");
Which prints this to the console:
Version: 5.3.0 true
For versions of GM prior to 0.9.16, you will either have to read your own script as @resource
, or use encapsulation methods, as shown in "Knowing Your Own Metadata" .
source share