简体   繁体   中英

Iframe content doesn't show on IE

We have a plugin which displays content on other websites using an iFrame. In IE 8 and 9, if there's a <!DOCTYPE html> in the parent's page, then the iframe loads, but its content remains blank.

Removing the DOCTYPE from the parent solves this.

I can't go around telling all the people using the plugin not to use <!DOCTYPE html> or to use something else, so I have to find another solution.

I own the code loading the iframe and the code inside the iframe, so any solution which is using these will be welcomed...

  • Use this <!DOCTYPE> , it might help you avoid overflowing IE.

     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> 

  • Try adding this <meta> tag in your <head> tags:
  •  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
    

  • That can also help you:
  • <!-- saved from url=(0014)about:internet -->
    

    Put it after the <!DOCTYPE HTML> tag.

  • You could use CSS Reset file.

  • Turns out that the problem was using display: table on the iframe. In IE7 & 8 it caused the entire content to disappear completely. @rolory's meta tag solution solves this, but I was afraid that it may also cause issues with the parent's content.

    Thanks everyone for the help.

    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