Solved

Most reliable script to detect IE7

Posted on 2006-11-10
6
1,473 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
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…

733 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