Opera 脚本和存储状态(如 Greasemonkey 中的 GM_SetValue)
有没有办法在 Opera 中存储用户脚本的状态? 在 GreaseMonkey 中可以使用 GM_SetValue/GM_GetValue。 我看到一个脚本在 Opera 中使用 cookies 来模拟它们,但我不喜欢这个想法,原因有几个(主要是 cookies 的大小有限)。 还有另一种存储状态的方法吗?
Is there a way to store state of user script in opera? In GreaseMonkey one can use GM_SetValue/GM_GetValue. I saw one script that emulates them in opera using cookies but I don't like this idea for several reasons(mainly for limitied size of cookies). Is there another way to store state?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我有 2 个想法:
1。 Google Gears
Google Gears 具有 数据库 API。 您可以存储& 使用 SQL 获取数据。
我知道这超出了您的目的的规格,但我想这种方式只是其中一种。
2. SharedObject (Flash)
Flash 可以使用 SharedObject 将数据存储到本地。
它与cookie类似,但比cookie大。
I have 2 idea:
1. Google Gears
Google Gears has Database API. You can store & get data with SQL.
I know it's over spec for your purpose, but I suppose this way is simply one.
2. SharedObject (Flash)
Flash can be stored data to local using SharedObject.
It's similar to cookie, but larger than cookie.
Violentmonkey至少支持GM_(delete/getset)Value。
但我确信互联网上也有,不是吗?
在使用这些之前,我使用了 localStorage ,这真的很棒。
它们与当今的所有浏览器兼容(甚至 Opera 12)。
它就像每个站点的 cookie:网站只会看到它自己的本地存储。
GM_setValue 是针对每个用户脚本的。
但实际上,由于用户脚本通常是为一个网站编写的,因此它是相同的。
你有这样的:
就容量而言,GM_setValue仅受你的硬盘空间的限制,localStorage的容量有限但很大,然后cookie的容量也非常有限。
Violentmonkey, at least, supports GM_(delete/getset)Value.
But I'm sure the internet ones too, no?
Before using those, I used localStorage, which is really great.
They are compatible with every browsers today (even opera 12).
It's like cookies as it's per site: a website will only see it's own local storage.
GM_setValue is per userscript.
But in practice, as a userscript is often written for one website, it will be the same.
You have this:
In terms of capacity, GM_setValue is only limited by your HDD space, localStorage had limited capacity but quite big and then cookies has very limited capacity.