我想获得一些关于包含元标记以确保与 IE 8 兼容的建议。问题是我的 html 代码包含元标记:
http-equiv="X-UA-Compatible" content="IE=8"
但是它不起作用,因为在带有 meta 标记的行之前,应用程序已经运行了一些 javascripts 作为响应渲染方法:
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.render(CssHeaderItem.forReference(new CssResourceReference(BasePage.class, "CSSPage.css")));
}
So that the line with meta tag conforming the web browser compatibility had been placed further, not at the first place, so in consequence ignored.
我试图在代码中添加一些 javaScripts 行,这些行应该将 meta 标记放在 html 脚本的开头:
$(document).ready(function(){
var meta = '<meta http-equiv="X-UA-Compatible" content="IE=8" />';
document.head.insertAdjacentHTML('afterbegin', meta);
});
也没用。
对于如何改进代码以使其与所需的网络浏览器版本兼容的任何建议,我将不胜感激:IE 8。
干杯,谢谢, 珍妮儿 它也没有用。
对于如何改进代码以使其与所需的网络浏览器版本兼容的任何建议,我将不胜感激:IE 8。
干杯,谢谢, 简爱丽
最佳答案
拥有<meta http-equiv="X-UA-Compatible" content="IE=8" />
在您的页面中没有使其与该浏览器兼容,我认为您对用法感到困惑。
The idea behind compatibility mode is to allow web sites and applications that are not designed to modern standards to continue to work while upgrades can be made, allowing end users to upgrade to the latest browser version.
继续阅读 x-ua compatability在这里。
关于javascript - JavaScript 和 Html 脚本中的元标记确保 Web 浏览器的兼容性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27966546/