Solved

Most reliable script to detect IE7

Posted on 2006-11-10
6
1,474 Views
Last Modified: 2008-01-09
Hi,
what will be the most reliable javascript script to detect IE7?
0
Comment
Question by:jyotishb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 26

Accepted Solution

by:
DireOrbAnt earned 250 total points
ID: 17917596
0
 

Author Comment

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

Expert Comment

by:DireOrbAnt
ID: 17917673
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
ID: 17928530
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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

726 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