IE 8.0 Version check

Cp_raj
Posted by in JavaScript category on for Beginner level | Views : 9025 red flag
Rating: 3 out of 5  
 1 vote(s)

To check the IE 8.0 Version after install in server

Introduction

How to check IE 8.0 Version in javascript



Problem faced.

Last week I came across a problem, which stop to think. The problem is regarding the IE8 Version.

Using the javascript I had checked the IE version (navigator.userAgent) in my local machine.


Solution & Code

But, I got shocked when I run it from server, it display me as MSIE 7.0. After that I came to knew that

To check the version for IE8.0 we need to check the document.documentMode.

The documentmode property returns a numeric value corresponding to the page’s document compatibility mode.for ex if a page has chosen to support IE8 mode,documentMode return the value 8

 

function IEVersion()

    {

        Version = "NA";

        if (window.navigator.appName == "Microsoft Internet Explorer")

        {

           // This is an IE browser. What mode is the engine in?

           if (document.documentMode) // IE8

                    Version = document.documentMode;

           else // IE 5-7

           {

              Version = 5; // Assume quirks mode unless proven otherwise

              if (document.compatMode)

              {

                 if (document.compatMode == "CSS1Compat")

                    Version = 7; // standards mode

              }

           }

        }

       

      return {

      "Version" : Version

       }        

    }

   

    var ieVersion = IEVersion();

    var IsIE8 = ieVersion.Version != "NA" && ieVersion.Version >= 8;

    alert(IsIE8);




Conclusion

To check the version for IE8.0 use document.documentMode.

Page copy protected against web site content infringement by Copyscape

About the Author

Cp_raj
Full Name: Rajkumar Pauldurai
Member Level: Starter
Member Status: Member
Member Since: 5/26/2009 6:29:52 AM
Country:

http://www.dotnetfunda.com
I started my career with Asp,ms-access,sql server 7,xml.Then i updated to .net,share point server,Basics about Biztalk server

Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)