javascript - ShowModalDialog 启动页面时忽略 X-UA-Compatible

标签 javascript jquery html internet-explorer x-ua-compatible

我想知道是否有人可以帮助我使用“X-UA-Compatible”标签来启动模式对话框。

我有以下页面:

<!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 id="Head1" runat="server">
         <meta http-equiv="X-UA-Compatible" content="IE=9" />
         <title></title>
     </head>
     <body onload="load()">
          <form id="form1" runat="server">
          <iframe name="fr1" frameborder="0" id="fr1" width="675px" height="550px"></iframe>

。 。 .

var src = http://someurl.web; 
document.all.fr1.src = src;

如果我直接浏览到此页面(不是浏览到 http://someurl.web ,而是浏览到其上带有指向 http://someurl.web 的 IFrame 的页面),“X-UA-Compatible”内容将正常工作,但是,如果我启动我的页面,如下所示:

window.showModalDialog(urlToPage, "", "dialogHeight: 550px; dialogWidth: 800px; center: Yes;")

“X-UA-Compatible”内容被忽略。为什么是这样?当通过 showModalDialog 启动页面时,我需要做什么才能识别该标签?当在 Intranet 站点上使用 IE9 时会发生这种情况,且“在兼容性 View 中显示 Intranet 站点”管理不允许取消选中此选项,因此需要使用“X-UA-Compatible”标签。

最佳答案

据我了解,在 IE9(及更高版本)中,如果在 iframe 中启动页面,文档模式将与父文档的模式匹配,无论任何 X-UA-Compatible元元素或服务器 header ,除非父级使用标准模式并且 iframe 指定怪异模式。我不知道解决方法。

参见http://blogs.msdn.com/b/ie/archive/2010/06/16/ie-s-compatibility-features-for-site-developers.aspx了解更多信息。

关于javascript - ShowModalDialog 启动页面时忽略 X-UA-Compatible,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19664738/

相关文章:

javascript - 需要减少表格宽度

jquery - 缓存 JSON 响应

javascript - 如果找不到内容,则折叠 HTML

javascript - 单击后将 html 对象传递给函数?

html - Bootstrap 3 中的谷歌地图全高

javascript - SendKey 进入浏览器控件 WinForm .Net

javascript - contenteditable:使用句柄时图像调整大小触发事件

javascript - 如何让用户选择的背景图像持久

javascript - 如何在 asp.net mvc 中重置 session 超时

python - 在元素和属性中搜索字符串