I have a page with an iframe A whose src attribute is a url that iteself contains an iframe B A. I want to access the src of this embedded iframe B. Is this possible at all? It seems browser security won't let this happen since the embedded iframe B comes from outside the domain of my iframe A.
You are correct; this is completely impossible.
Otherwise, I could write a page that loads Gmail in a hidden <iframe>
and read your email.
yea the browser security prevents you
but theres other ways of getting crossdomain content you can use http://developer.yahoo.com/yql/
there some plugins for jquery to if thats you cup
HTML5 actually has a security model for this. Check out PostMessage in HTML5 compliant browsers. There is a demo here: http://html5demos.com/postmessage2
If not, jQuery has a nice plugin that supports this, and even has a fallback to using the anchor tag to communicate if running in a browser that does not support PostMessage properly: http://benalman.com/projects/jquery-postmessage-plugin/
Good luck!
:)
You cannot for the reason you guessed at. However, if you have control over the contents of that other domain's frame, there are ways you can add cross-domain frame communication.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.