Re: Firefox plugin - Not able to hide the tab browser
Neil <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xpfe |
|---|---|
| Message-ID | <[email protected]> |
Pradeep Dewda wrote:
>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');
> return priceNode.innerHTML;
> }
> }, true);
>
>How can i hide the above tab in the browser?
>
>
I assume the reason you can't use XHR is that you need scripts to run in
the page.
I guess your best best is to create a hidden <iframe> element. Set the
type="content" and collapsed="true" attributes before adding it to the
DOM. See
https://developer.mozilla.org/en-US/docs/Code_snippets/HTML_to_DOM
(scroll down to Using a hidden iframe element to parse HTML to a
window's DOM).
But why are you parsing the result of innerHTML instead of locating the
DOM node directly?
--
Warning: May contain traces of nuts.