Solved

Most reliable script to detect IE7

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

785 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