Sowmya
Sowmya

Reputation: 26969

browser detection in javascript

I need to show a different webpage when i open my website in IE6 and below version.

Need to show fbrowser.html file when my website opens in IE6 and below versions.

Please suggest!!

Upvotes: 3

Views: 402

Answers (3)

Marvin Pinto
Marvin Pinto

Reputation: 30980

According to this answer, you can try somethiing like the following:

<script type="text/javascript">
    // <![CDATA[
    var BrowserCheck = Class.create({
        initialize: function () {
            var userAgent = navigator.userAgent.toLowerCase();
            this.version = (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1];
            this.safari = /webkit/.test(userAgent) && !/chrome/.test(userAgent);
            this.opera = /opera/.test(userAgent);
            this.msie = /msie/.test(userAgent) && !/opera/.test(userAgent);
            this.mozilla = /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent);
            this.chrome = /chrome/.test(userAgent);
        }
    });    
    // ]]>
</script>

Upvotes: 0

Mr Lister
Mr Lister

Reputation: 46549

In head:

<!--[if lte IE 6]>
<meta http-equiv="refresh" content="0; url=fbrowser.html">
<![endif]-->

Sorry, no javascript needed.

Upvotes: 4

nwaltham
nwaltham

Reputation: 2074

You could consider using http://api.jquery.com/jQuery.browser/

Upvotes: 1

Related Questions