无法在附加套件 API 中设置 Firefox 书签描述
我找到了 nsINavBookmarksService ,但是从 Firefox 3 开始,它似乎没有任何用于获取/设置书签描述的 API 方法。 (API doc)
我见过其他附加组件修改描述为同步数据存储的方法(这正是我想要做的)。我猜测也许该描述是一个非 gecko 标准,这就是为什么它不被直接支持的原因,但是必须有一个完全不同的接口来操作我还没有发现的书签。
谁能帮忙解决这个新手问题吗?
I found the nsINavBookmarksService
, however since Firefox 3, it does not seem to have any API methods for getting/setting the Bookmark description. (API doc)
I've seen other Add-Ons modify the description as a method of synchronized data storage (which is exactly what I'm trying to do). I'm guessing perhaps the description is a non-gecko standard, and that's why it is not directly supported, but then there must be a completely different interface for manipulating Bookmarks that I haven't discovered.
Can anyone help with this newbie problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从 Firefox 3 开始,书签已合并到包含所有浏览历史记录的位置数据库中。因此,要获取书签,请执行历史查询,如下所示(第一行是 特定于您似乎正在使用的附加 SDK):
这与代码示例 此处。您的问题当然是 nsINavHistoryResultNode 无法存储像描述这样的数据。不过,您可以设置注释,请参阅使用地点注释服务。因此,如果您的书签已经有一个
node
变量:供参考:nsIAnnotationService.setPageAnnotation()
Starting with Firefox 3 the bookmarks have been merged into the Places database containing all of your browsing history. So to get the bookmarks you do a history query, like this (first line is specific to the Add-on SDK which you appear to be using):
That's mostly identical to the code example here. Your problem is of course that nsINavHistoryResultNode has no way of storing data like a description. You can set annotations however, see Using the Places annotation service. So if you already have a
node
variable for your bookmark:For reference: nsIAnnotationService.setPageAnnotation()