Javascript 在第一次运行Greasemonkey脚本时执行函数

Javascript 在第一次运行Greasemonkey脚本时执行函数,javascript,greasemonkey,Javascript,Greasemonkey,如何在第一次运行greasemonkey脚本时运行函数?您可以使用GM\u setValue和GM\u getValue来存储设置等 尝试“获取”一面旗帜。如果未设置,请进行第一次运行调用,然后设置该值。乙二醇 var isfirstrun = GM_getValue('firstrun', '0'); if (isfirstrun == '0') { // value not set, so must be the first run DoSomething(); GM

如何在第一次运行greasemonkey脚本时运行函数?

您可以使用
GM\u setValue
GM\u getValue
来存储设置等

尝试“获取”一面旗帜。如果未设置,请进行第一次运行调用,然后设置该值。乙二醇

var isfirstrun = GM_getValue('firstrun', '0');
if (isfirstrun == '0')
{
    // value not set, so must be the first run
    DoSomething();
    GM_setValue('firstrun', '1');
}
这些文件是