开发一个调用“另存为”的 Firefox 插件/附加组件来自FF自己的一套函数
我有一个基本的 FF 插件,可以轮询 window.document 页面 DOM 中的某些内容。当它看到它时,它应该保存该页面。这是最困难的部分。我不想复制“保存完成”的功能,我只想在适当的时候从插件/插件中调用预先存在的功能。
这是 XPCom 的事情吗?或者是通过相关 API 的纯 JavaScript?
iMacros for Firefox 可以调用另存为(无需弹出相关的对话框),但我不知道如何。
任何人都可以建议如何调用像这样更深层次的 Firefox 函数吗?
谢谢,- Paul
PS - 我真的很喜欢 Mozilla 存档格式, MHT 和 Faithful Save 但我认为它再次复制了功能。我的另一种选择是调用它的函数,但这对我来说就像 Firefox 本机函数一样不透明。
I have a basic FF addon that polls for something in the DOM of the page in window.document. When it sees it, it is supposed to save the page. That's the hard part. I don't want to replicate the functionality of "save complete" I just want to call the pre-existing functionality from the plugin/addon at the right moment.
Is this an XPCom thing? Or is it pure JavaScript via the relevant APIs ?
iMacros for Firefox can invoke Save-as (without popping the associated dialog), but I can't see how.
Can anyone advise as to how to call deeper Firefox functions like this?
Thanks, - Paul
PS - I really love Mozilla Archive Format, with MHT and Faithful Save but I think it is replicating functionality again. My alternative is to invoke it's function, but that's as opaque to me as the firefox native one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 nsIWebBrowserPersist.saveDocument() 来实现此目的:
关键是第三个参数,它指定链接的 URI 的存储位置。请参阅http://mxr.mozilla.org/mozilla2.0/source/embedding/components/webbrowserpersist/public/nsIWebBrowserPersist.idl#256 获取完整文档。
You can use nsIWebBrowserPersist.saveDocument() for this:
The key is the third parameter which specifies where the linked URIs should be stored. See http://mxr.mozilla.org/mozilla2.0/source/embedding/components/webbrowserpersist/public/nsIWebBrowserPersist.idl#256 for complete documentation.