网站没有';t可以在IE8中使用,但可以在谷歌Chrome中使用


Website doesn't Work in IE8 but works in Google Chrome

我的网站管理面板中有一个侧边栏,我在Yii Php Framework中制作了它,但我的网站在谷歌chrome、mozilla中运行良好,但当我使用Internet Explorer 8时……我的网站管理员面板中的侧边栏不会出现。

我该如何解决这个兼容性问题,以便它也能在IE8中工作?

这是我的代码:

<!--[if lt IE 9] >
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif] -->
<?php
if (stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE 10')) { ?>
    <link href="<?php echo Yii::app()->request->baseUrl; ?>/themes/mydesign/assetsadmin/global/css/ie10.css" rel="stylesheet">
    <?php   }
?>
<!--[if IE 9]>
<link href="<?php echo Yii::app()->request->baseUrl; ?>/themes/mydesign/assetsadmin/global/css/ie9.css" rel="stylesheet">
<![endif]-->
<!--[if IE 8]>
<link href="<?php echo Yii::app()->request->baseUrl; ?>/themes/mydesign/assetsadmin/global/css/ie8.css" rel="stylesheet">
<![endif]-->

多年来,旧版本的Internet Explorer给网页设计师带来了无尽的头痛。IE 8于2009年发布,一些人认为支持它是任何人都不应该再做的事情。但它仍在使用,截至本文撰写之时,其全球市场份额为5.95%

如果支持IE8对你来说很重要,那么你需要做一些调试。例如,如果某个组件没有显示,请尝试从中删除CSS样式,看看它是否显示,然后逐个重新添加样式。

我也支持这里的其他建议。使用html5shiv添加对HTML5元素的支持,使用modernizr检测浏览器功能,并根据需要添加polyfill。

不确定YII框架,但如果在IE8中支持HTML5,请查看以下代码如果您还没有添加此代码,则将其添加到<head>

<!--[if lt IE 9]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

你试过modernizr吗?Modernizr是一小段JavaScript代码,它可以自动检测用户浏览器中下一代网络技术的可用性。

在您的项目中包括现代化器,并添加以下

<!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>
<head>