eozzy
eozzy

Reputation: 68680

Find element inside an iframe (external domain)

Is there any way to access elements loaded inside an iframe?

I'm trying this but doesn't seem to work:

if($('#cboxLoadedContent iframe').contents().find('#customer-login')[0] ){ ... }

Upvotes: 0

Views: 4344

Answers (2)

eozzy
eozzy

Reputation: 68680

It worked, I hd opened the file locally (file://) whereas the content was loaded with http:// protocol.

Upvotes: 0

Denys Séguret
Denys Séguret

Reputation: 382160

If the content of the iframe is provided by another domain, the only way you can see its content from your page is that this content is given with appropriate CORS headers.

This is a protection scheme known as Same Origin Policy.

Note that there is also the solution to let the browser see only one domain, by using a proxy.

Upvotes: 1

Related Questions