Tag <Meta http-equiv=“X-UA-Compatible” ..> f

2019-06-25 23:41发布

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?

2条回答
smile是对你的礼貌
2楼-- · 2019-06-25 23:57

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).

查看更多
Melony?
3楼-- · 2019-06-26 00:05

The page is rendered according to the topmost frame (the browser mode is set only once at the beginning and all values in nested frames are being ignored).

查看更多
登录 后发表回答