我想知道是否有人可以帮助我使用“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/