gpt4 book ai didi

jquery - Greasemonkey + jQuery : using GM_setValue() within an event callback

转载 作者:行者123 更新时间:2023-12-01 00:42:04 24 4
gpt4 key购买 nike

我正在尝试在 GreaseMonkey 脚本中设置长期存储中的数据,但 GM_setValue() 似乎默默地失败了:

$("a#linkid").click(function()
{
GM_setValue("foo", 123); // doesn't work, but does not generate error
});

GM_setValue("bar", 123); // works properly, value is set

最佳答案

我认为这是一个特定的 Greasemonkey 安全问题。请参阅0.7.20080121.0 compatibility 。 GM 不允许用户页面调用 GreaseMonkey API,而这就是您正在做的事情(您正在使用在用户上下文中运行的 JQuery 注册点击处理程序)。该页面上还给出了解决方法。

关于jquery - Greasemonkey + jQuery : using GM_setValue() within an event callback,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/860829/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com