简体   繁体   中英

Tag <Meta http-equiv=“X-UA-Compatible” ..> for Iframe not works in IE8

I got such structure of HTML for IE.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body id="body">
    <div>
      <iframe>
         <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
         <html xmlns="http://www.w3.org/1999/xhtml">
            <head></head>
            <body> 
                <!-- Here goes some graphic content using dojo libs -->
            </body>
         <html>      
      </iframe>
    </div>
</body>
<html>

When I insert to the both headers (main and header of iframe html) tag

<meta http-equiv="X-UA-Compatible" content="IE=8,IE=9"/>

nomatter what content inside a tag (IE=8 or IE=8,IE-9 or IE=EDGE etc)

the inner iframe doesn't generate under IE8 browser mode. But!! works fine under IE7 or IE9

When I remove the tag - works fine in all versions of IE.

Where is the problem? In DOCTYPE, the tag or elsewhere?

页面根据最顶层的帧进行渲染(浏览器模式在开头只设置一次,嵌套帧中的所有值都被忽略)。

Through testing I can confirm rocky 's answer. I was able to get IE9 to render standards mode by changing the doctype of my topmost frame. I did not need to send the X-UA-Compatible header or meta tag.

Any frames inside the top one will not alter the mode, so my structure of

<!doctype html>
<html lang="en">
    ...
    <iframe>
        <!DOCTYPE HTML PUBLIC "-//W3C//Dtd HTML 4.0 transitional//en">
        <html>
        ...
        <iframe>
            <!DOCTYPE html>
            ...

results in standards mode for all frames, including the third one where html5 is rendered correctly.

(yes yes, it's ugly, but unfortunately part of a fixed application).

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