firefox 插件:回顾脚本
我是扩展程序编程的新手,但发现在 Chrome 中制作扩展要容易得多,但现在我正在尝试将我的测试扩展移植到 FF,我有几个问题如何做与我在 Chrome 中所做的相同的事情......现在在FF。
例如: 在 Chrome 中,我的扩展目录中有一个页面,名为:domains.html 我从弹出窗口链接到该页面,它可以访问我的所有脚本等,但“外部”世界无法直接访问它。
FF 中是否有这样的东西,以便我可以显示我的附加文件夹中的页面并可以访问我的附加组件的 JS 和其他文件?
谢谢!
I am new to extension programming but find making extensions in Chrome much more easier, but now that I am trying to port my test extensions to FF I have a few questions of how to do the same things I do in Chrome... now in FF.
For example:
In Chrome I have a page in my extensions directory called: domains.html
I link to that page from my popup and it has access to all my scripts etc but the "outside" world cannot directly access that.
Is there any such thing in FF so that I can show a page that is in my add on folder and has access to my add-on's JS and other files?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看一些有关在新选项卡中打开 URL 并操作选项卡内容的文档:
https://developer.mozilla.org/en/Code_snippets/Tabbed_browser#Opening_a_URL_in_a_new_tab
一旦您对此感到满意,请尝试打开您的 HTML 页面 添加在。首先,您需要了解在 chrome.manifest 文件中注册的“内容”包名称。其次,确保您的“domains.html”文件位于附加组件的内容文件夹中。要使用 Firefox 中的按钮或菜单在新选项卡中打开网页,请使用如下代码:
您应该能够使用类似的 chrome:// URI 将附加组件中的其他 JS 和 CSS 文件加载到网页中。
Take a look at some of the docs for opening URLs in new Tabs and manipulating the content of the tab:
https://developer.mozilla.org/en/Code_snippets/Tabbed_browser#Opening_a_URL_in_a_new_tab
Once you get comfortable with that, try opening an HTML page that lives in your add-on. First, you need to be aware of the 'content' package name you registered in your chrome.manifest file. Second, make sure your 'domains.html' file is in the content folder of your add-on. To open the web page in a new tab using a button or menu in Firefox use code like this:
You can should be able to load other JS and CSS files from your add-on into the web page using similar chrome:// URIs.