firefox - Opening a xul file in response to a toolbar extension button click -


I am currently building my first Firefox extension, and being a bit difficult with a piece of functionality. I want to open a new browser tab in response to a button click on the toolbar. The new tab should contain the contents of the webpage with some extra buttons.

At the moment I have created a separate Axl file for the contents of the new tab:

   & Lt; Toolbox & gt; & Lt; Toolbar id = "nav-toolbar" & gt; & Lt; Toolbar Button Label = "It-of-Is-Something-Accessories" / & gt; & Lt; / Toolbar & gt; & Lt; / Toolbox & gt; & Lt; Iframe id = "myapp-report-frame" flex = "1" /> & Lt; Script type = "text / javascript" & gt; Function Load Page (URL) {document.getElementById ('myapp-report-frame') SetAttribute ('src', url); } & Lt; / Script & gt; & Lt; / Window & gt;  

This xul file is referenced from this mysptoolbar.xul through this javascript:

  gBrowser.selectedTab = gBrowser.addTab (' Chrome: / /myapp/content/report.xul '); Var newTabBrowser = gBrowser.getBrowserForTab (gBrowser.selectedTab); NewTabBrowser.addEventListener ("load", function () {loadPage ('http://www.somedynamicallysetwebsite.com');}, true);  

The problem I have is that the loadPage function is not found, so the src attribute of the iframe is never set. I'm sure this is some silly problem, but I am very new to the Firefox extension (day 2!) So any help would be greatly appreciated.

I am new to myself on this, in fact, stumbled back here because I have more questions about the Firefox extension I was trying to ask, but I think I can help.

Um, your loadpage function gets newtab Axel is declared and therefore, Myapptoolbar.xul can be said, I think XUL files are with privilege by enhancing HTML files and therefore share similar properties. You can declare the function within the App.JS and after that it includes both apps: AJA File: -

  & lt; Script type = "application / x-javascript" src = "chrome: //app/content/app.js" />  

At the top, place elsewhere in that place. In college. Axle line would be nice. Just do things that you would normally do on an HTML page.

I hope it helps =) wish you a good luck!


Comments