0
奇怪的行为,请看看这个html页面:HTML条件注释表现出IE9
<!DOCTYPE html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]><html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]><html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--><html class="no-js"><!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Test</title>
<meta name="description" content="">
<!--[if IE 7]>
<script type="text/javascript">alert("IE7")</script>
<![endif]-->
<!--[if IE 8]>
<script type="text/javascript">alert("IE8")</script>
<![endif]-->
<!--[if IE 9]>
<script type="text/javascript">alert("IE9")</script>
<![endif]-->
</head>
<body data-pagename="home">
</body>
</html>
我不明白为什么,如果我在IE8和IE7浏览这一切工作正常,而如果我查看的页面IE9的警报就好像我在IE7中一样。
如果我改变头标记之前的创举线与
<!DOCTYPE html>
<html class="no-js">
<head>
一切工作正常。
就好像doctype和head之间的东西改变了渲染beahviour。 现在的问题是: 这是我的错,也许是因为我用非法的方式使用或者是IE9的错误?
如果您完全删除前两个条件警报,但将所有''标记都留在那里,该怎么办? – BoltClock
无法在IE9上重现。你确定你没有意外改变浏览器模式吗?检查F12。 –
@JoeriHendrickx我没有改变浏览器模式。我只在关闭/打开浏览器后才加载页面。 –