简体   繁体   中英

Generating dynamic content in Iframe IE 7

Is it possible to generate dynamic content inside Iframe? if yes , how ? I'm having some problems with IE, thank you

UPDATE :

I'm creating a modal window which plays video, but when I close it it remains playing in IE7 although its hidden but it firefox it stops playing as it should. So I just wanted to try with iframe, thinking maybe that will solve my problem :)

An iframe is just like any other HTML window, so yes, you can generate dynamic content.

To create content use the normal syntax:

var div = iframe.document.createElement("div");

Please include a description of what exact problem you face. Otherwise, we can't help much.

[EDIT] Note that the URL of the document in the iframe must contain the same domain or the Same Origin Policy will prevent the access.

As for your problem with the modal window: Are you saying that the window doesn't close? That sounds like a IE bug :/

As @Aaron already noted, you can use everything you use for normal pages in your iFrame.

Noteworthy however is that the content in the iframe is an isolated page.
No code from your parent page can access anything in the iframe's page.
This is a security measure that prevents Evil People from showing you trusted pages with custom javascript hooks attached.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM