由于命名空間改變,unsafeWindow下無(wú)法調(diào)用GM_getValue和GM_setValue如下
//使用正常
GM_setValue(‘foo’,true);
GM_etValue(‘foo’);
//不能訪問(wèn)GM值的
$(“#btnPost”).click(function(){
GM_setValue(‘foo’,true);//此時(shí)無(wú)法設(shè)置值
GM_etValue(‘foo’);//這里也得不到值
//可以使用以下方法解決
//外面套一個(gè)setTimeout()
setTimeout(function(){
GM_setValue(‘foo’,true);//可以寫(xiě)入值
GM_etValue(‘foo’);//可以得到值
},0)
})
解決方案來(lái)源與官方文檔 http://wiki.greasespot.net/0.7.20080121.0_compatibility
希望對(duì)你有用。Enjoy it.
http://www.radys.cn/article.asp?id=295