Question

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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top