Access iframe content in Adobe Air

I'm having a lot of trouble figuring out how I can access content in an iframe in Air. Here is a sample jquery code that I tested with.


$(document).ready(function(){
    $("#frame").ready(function(){
        air.trace($("#frame").contents().find("body").html());
        air.trace(window.frames["frame"].innerHTML);
        air.trace(document.getElementById("frame").innerHTML);
    });
});

I am using iframe.

<iframe src="http://google.com" id="frame" width="100%" sandboxRoot="http://google.com/" documentRoot="/" name="frame" height="600"></iframe>

Exit from above code


null
undefined


As you can see, the content is always null, undefined, or an empty string. Am I missing something that is stopping me from accessing iframe content? Any suggestions would be appreciated.

+2
source share
3 answers

The solution was here http://help.adobe.com/en_US/AIR/1.1/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7f08.html

Here is an example of how I worked.

<iframe src="http://google.com/local/iframe.html" id="frame" width="100%" sandboxRoot="http://google.com/local/" documentRoot="app:/" name="frame" height="600"></iframe>

sandboxRoot (, http://google.com/local) , (google.com).

iframe.html iframe Google, .

, :)

+3

, .

tomfmason, , , .

- , AIR html + js - -, AIR 3.2 (1,7 .zip ), :

http://adobe-air-js.blogspot.com/2011/12/air-reading-dom-of-remote-web-page.html

AIR , . /, .

! ~

+2

Adobe AIR - (WebKit ), , , . , , " ".

If it is not in the same domain, the browser will not allow you to access data or content from this site, so you will get this result. Use the Json-based AJAX API if you want to retrieve data from another domain.

An example of someone who has this problem:

+1
source

All Articles