我们开发了 JSR 286 portlet。在 IE8 中加载 JSP 页面时,我们遇到了一些对齐问题,导致我们的屏幕无法正确加载。
我们可以弄清楚,这是因为 IE 8 的兼容性问题。默认情况下,页面在 IE8 中以 Quirks 模式加载。如果我们将模式更改为 IE8 标准,我们可以看到页面加载没有任何问题。我可以发现我们可以设置一个元<meta http-equiv='X-UA-Compatible' content='IE=EmulateIE8' />"
来从 JSP 启用 IE8 标准模式。
但是如何将元标记添加到 portlet 页面的 head 元素中?由于我的 Web 应用程序中没有<html>
,<head>
和<body>
标签,并且它将从 portlet 容器生成,我如何将元标签添加到 head 元素?
doHeader
我也尝试按如下方式覆盖该方法
protected void doHeaders(RenderRequest request, RenderResponse response) {
Element metaKeywords = response.createElement("meta");
metaKeywords.setAttribute("http-equiv", "X-UA-Compatible");
metaKeywords.setAttribute("content", "IE=EmulateIE8");
// response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, ""); - I tried this option also
//response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, metaKeywords); - I tried this option also
}
但没有任何结果。
我们的应用程序在 WAS 7.0 上运行。
任何人都可以提供一些指示吗?