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