Solved

Most reliable script to detect IE7

Posted on 2006-11-10
6
1,470 Views
Last Modified: 2008-01-09
Hi,
what will be the most reliable javascript script to detect IE7?
0
Comment
Question by:jyotishb
  • 2
6 Comments
 
LVL 26

Accepted Solution

by:
DireOrbAnt earned 250 total points
Comment Utility
0
 

Author Comment

by:jyotishb
Comment Utility
yes i have found that one.. but dont really know how reliable that was.. thanks anyways
0
 
LVL 26

Expert Comment

by:DireOrbAnt
Comment Utility
Did you look at the conditionnal comment? So do something like:
<script type="text/javascript">
var ie7 = false;
<!––[if IE 7]>
ie7 = true;
<![endif]––>
</script>
0
 
LVL 6

Assisted Solution

by:badalpatel
badalpatel earned 250 total points
Comment Utility
i am using one good function that will detect almost all browser...hope this might be helpful

function browsercheck()
{
    var detect = navigator.userAgent.toLowerCase();
    var OS,browser,version,total,thestring;

    if (checkIt('konqueror'))
    {
          browser = "Konqueror";
          OS = "Linux";
    }
    else if (checkIt('safari')) browser = "Safari"
    else if (checkIt('omniweb')) browser = "OmniWeb"
    else if (checkIt('opera')) browser = "Opera"
    else if (checkIt('webtv')) browser = "WebTV";
    else if (checkIt('icab')) browser = "iCab"
    else if (checkIt('msie')) browser = "Internet Explorer"
    else if (!checkIt('compatible'))
    {
          browser = "Netscape Navigator"
          version = detect.charAt(8);
    }
    else browser = "An unknown browser";
   
    if (!version) version = detect.charAt(place + thestring.length);
    if (browser != "Internet Explorer")
    {
        alert("it is not iE");
    }
    else
    {
        if(version = 7)
        {
            alert("IE version is 7");
        }
    }  
    if (!OS)
    {
          if (checkIt('linux')) OS = "Linux";
          else if (checkIt('x11')) OS = "Unix";
          else if (checkIt('mac')) OS = "Mac"
          else if (checkIt('win')) OS = "Windows"
          else OS = "an unknown operating system";
    }

    function checkIt(string)
    {
          place = detect.indexOf(string) + 1;
          thestring = string;
          return place;
    }

}
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now