What i am doing is a new image uploader, i want to put the input file in the iframe and show the uploaded images in the parent page. So how can i access the parent elements from the inner iframe? or if some one have an example, that will be nice as well.
A:
You have limited options since iframes are not compatible browser-wide.
If you really stick to it, you can have it done only via server-side. JavaScript handles iframes incorrectly in many contexts, it is insecure, uncertain and doubtedly.
If you are open-minded enough, check out Ajax frameworks to change your uploading iframe into a smooth and effective uploader.
If you're interested in the latter, examples might be available on the air.
pestaa
2009-03-10 13:20:32
my problem that its not allowed to put input file tag inside update panels, and i am not allowed to use swf uploaders
Amr ElGarhy
2009-03-10 13:22:25
A:
I dont think you can, else I could just inject my IFRAME into your page, and go ape. From a security point of view.
leppie
2009-03-10 13:31:38
yeah sure, from security point of view that impossible if the iframe load a page from another domain, but if the same domain it will work.
Amr ElGarhy
2009-03-10 13:33:29
+2
A:
Frame object .parent will allow you to access the outer, or even document.top. If the two pages are not on the same domain your browser will likely block the script execution as an XSS attack.
ck
2009-03-10 13:37:37
how to do so in code? i want to call the parent from inside the iframe
Amr ElGarhy
2009-03-10 13:45:08
Inside the frame call document.top - in IE7 and Firefox it will give you the outer document object
ck
2009-03-10 14:12:09