Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Getting content outside an iframe
2 points by amrithk on July 29, 2008 | hide | past | favorite | 2 comments
I remember seeing a similar post to this some time ago but I am not able to find it. Sorry for the repeated posting.

I have an iframe that sources an upload page (for images). Basically, when a user uploads an image, the script returns the location of the image if the upload was successful. Is there a way to obtain this image src outside the iframe (which house the upload page) on the main page?

Thanks




Give the iframe an id, select by that id, and then access that variable's contentWindow.document field.


Also don't forget to source the image and the containing page at the same server, or alternately to set document.domain of each side to the common superdomain.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: