我想知道是否有人可以帮助我使用“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兼容”内容将正常工作但是,如果我按下面的方式启动我的页面:
window.showModalDialog(urlToPage, "", "dialogHeight: 550px; dialogWidth: 800px; center: Yes;")
忽略“X-UA兼容”的内容。为什么是这样?当通过showModalDialog启动该页面时,我需要做什么才能识别该标记?当在Intranet站点上使用IE9并在“兼容性视图中显示Intranet站点”时,会发生这种情况。管理将不允许取消选中此项,因此使用“X-UA-Compatible”标记。
答案 0 :(得分:2)
据我了解,在IE9(及更新版本)中,如果在iframe中启动页面,则文档模式将与父文档的模式匹配,而不管任何X-UA-Compatible
元元素或服务器标头,除非父级使用标准模式,iframe指定怪异模式。我不知道有一种解决方法。
有关详细信息,请参阅http://blogs.msdn.com/b/ie/archive/2010/06/16/ie-s-compatibility-features-for-site-developers.aspx。