user985393
user985393

Reputation: 83

Read iframe content cross domain JavaScript

I am loading website (Site A) into my Iframe from my application(Site B). The loading site and my app hosted in different domain? I need to read content from Site A from my Site B. I have gone through so many links, but I can't find any solution from those links

Is there any way to set permission (Access-Control-Allow-Origin) in Site A for Site B to access? if not, any possible way?

Upvotes: 0

Views: 2488

Answers (1)

Ryan O'Neill
Ryan O'Neill

Reputation: 1790

There is no good way to do this, for security reasons. A couple of browsers have some hacky ways around it, but cross-browser compatibility becomes an issue.

If you have control over both domains you can use something like easyXDM to message back and forth.

http://www.webresourcesdepot.com/easyxdm-a-javascript-library-for-cross-domain-messaging/

If you don't have control of both domains you will not be able to accomplish what you are trying.

Upvotes: 1

Related Questions