0

私は拡張機能のプログラミングは初めてですが、Chrome で拡張機能を作成する方がはるかに簡単だと思いますが、テスト拡張機能を FF に移植しようとしている今、Chrome で行っているのと同じことを行う方法についていくつか質問があります... FF。

例: Chrome では、拡張機能ディレクトリに domain.html というページがあります。ポップアップからそのページにリンクすると、すべてのスクリプトなどにアクセスできますが、「外部」の世界はそれに直接アクセスできません。

アドオン フォルダにあるページを表示し、アドオンの JS やその他のファイルにアクセスできるようにするために、FF にそのようなものはありますか?

ありがとう!

4

1 に答える 1

2

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:

 gBrowser.addTab("chrome://mypackagename/content/domains.html");

You can should be able to load other JS and CSS files from your add-on into the web page using similar chrome:// URIs.

于 2011-05-18T04:35:45.330 に答える