Search code examples
javascriptfirefox-addonxultabbed-browsing

firefox plugin - How to hide a tab browser and getting its content


I am developing a plugin for firefox. In which i have to open a hidden tab and access its content through javascript and close it afterwards.

Following is the code i am using for accessing content of a tab:

var newTabBrowser = gBrowser.getBrowserForTab(gBrowser.addTab("www.kayak.com/flights#/BOM-ORL/2013-05-14/2013-06-19"));
var contentdata = "";
newTabBrowser.addEventListener("load", function () {
    contentdata = contentdata + newTabBrowser.contentDocument.body.innerHTML;
    load = load + 1;
    if(load == 5) {
        var DOMPars = new DOMParser();
        var dom = DOMPars.parseFromString(contentdata, "text/html");
        var priceNode = dom.getElementById('low_price');
    }
}, true);

How can i hide this tab in the browser?


Solution

  • It look like you just need to create a permanent, invisible page and access its DOM.

    Addon-SDK provide a page-work module. Do this what you want?