Firefox OS - Launch external link inside Firefox OS app and retrieve its content

230 views Asked by At

I have a Firefox OS app in which I have opened an web page via mozbrowser attribute.

<iframe id="inlineFrameExample"
    mozbrowser=true 
    src="<some external link>"
</iframe>

How can we retrieve DOM content of the iframe?

1

There are 1 answers

0
a123 On

You can retrieve DOM content via executeScript() method present in Browser API. It will run the script against the iframe and will allow you to do DOM computation tasks.

Note: The example mentioned in the document didn't worked but the syntax given below worked for me. The diff is is passed as string.

iframe.executeScript('put_your_script_here', {origin: 'domain_name'});