您可以使用 htaccess 来阻止 MSIE
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} MSIE
RewriteCond %{REQUEST_FILENAME} !ban_ie.php
RewriteRule .* /ban_ie.php [L]
RewriteCond %{HTTP_USER_AGENT} MSIE
RewriteCond %{REQUEST_FILENAME} !ban_ie.php
RewriteRule .* /ban_ie.php [L]
</IfModule>
或者你可以使用 php 脚本
<?php
ob_start();
?>
<html>
<head>
<style type="text/css">
* {
margin:0;
padding:0;
height:100%;
}
#mydiv {
position:absolute;
width:400px;
height:90px;
text-align:center;
top:50%;
left:50%;
margin-top:-40px;
margin-left:-200px;
border:solid 2px red;
padding-top:30px;
background:#ffff00;
font-weight:bold;
}
</style>
</head>
<body>
<div id="mydiv">
<?php
$browser = $_SERVER['HTTP_USER_AGENT'];
if(strstr($browser, "MSIE"))
{
echo"BG: Свалете си Mozilla Firefox за да влезнете в сайта EN: Download Mozilla Firefox to enter website <br /> <b><a href='http://www.mozilla.com/en-US/firefox/'>Mozilla Firefox</a></b>";
}
elseif (strstr($browser, "Opera"))
{
echo"Свалете си мозилла <br /> <b><a href='http://www.mozilla.com/en-US/firefox/'>Mozilla Firefox</a></b>";
}
else {
header("Location: http://muonline-bg.eu/");
}
?>
</div>
</body>
</html>