2014-01-16 30 views
1

我有一个IE8支持的网站。我想用新网站替换它,但新网站不支持IE8。如果浏览器版本低于IE9,有什么方法可以将新网站重定向到显示旧网站本身。 (网站完全是html n css)基于IE浏览器版本的网站重定向

谢谢。

回答

1

只要写这些线在顶部

<!--[if IE 8 ]> <META http-equiv="refresh" content="0;URL=http://oldurl.com"> <![endif]--> 

与IE8支持的URL

+0

现在,这是一个非常好的主意。 – 2014-01-16 07:21:49

+0

我试过这个,但它没有工作 – user3201356

+0

好吧,它确实工作了,并将其粘贴在头下 – sanjeev

1

首先设置你的IE类正确

<!doctype html> 
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]--> 
<!--[if IE 7 ]> <html class="ie7"> <![endif]--> 
<!--[if IE 8 ]> <html class="ie8"> <![endif]--> 
<!--[if IE 9 ]> <html class="ie9"> <![endif]--> 
<!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]--> 
<head> 
And add some simple script: 

(function ($) { 
    "use strict"; 

    // Detecting IE 
    var oldIE; 
    if ($('html').is('.ie6, .ie7, .ie8')) { 
     oldIE = true; 
    } 

    if (oldIE) { 
     window.location.href="new url"; 
    } else { 
     // ..And here's the full-fat code for everyone else 
    } 

}(jQuery)); 

源替代oldurl.com - http://www.paulirish.com/

+0

这是浏览器嗅探技术。完全不建议。 – 2014-01-16 07:21:11

+1

@ aliasm2k - 编辑,现在检查 – Rohan

+0

此代码是好的,并建议。 – 2014-01-16 07:27:16