Online Shopping : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

8 of 15 people (53%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How can I use javascript to check for the IE version of a browser?

Apr 7th, 2008 23:25
ha mo, Colin Fraser, tola,


I am sure this question has been answered many times before, but it is
good for it to appear none-the-less. It is one of the fundamental
aspects of using Javascript and there is always new-comers to the field. 
try: 
function versionFive() {
   alert("You are using "+navigator.appName+" Version
"+navigator.appVersion+"." );
}
function bName() {
  // return 1 for Internet Explorer
  if (navigator.appName == "Microsoft Internet Explorer")
    return 1;
  // return 2 for Navigator
  if (navigator.appName == "Netscape")
    return 2;
  // return 0 for other browsers
  return 0;
}
function bVer() {
  // return version number (e.g., 5.5)
  return parseFloat(navigator.appVersion)
}
var nameCode = bName();
var versionCode = bVer();
if ((nameCode != 0) && (versionCode >= 4)) {
  versionFive();
}
// -->
</SCRIPT>
This script demonstrates an alert box that displays information about
the browser. 
I dont know where I got this from, probably theSourceForge or somewhere
like that. You may also try the link in the Javascript index to Dan
Stienman's Dynamic Duo site (I think it is still there). This is a very
good site that explains a lot about using dynamic scripting methods.
Just be aware that it has not been updated for a while and while an
excellent site in itself, it may also be a little advanced for the
novice. Just relax, take it easy and bookmark it  knowing that you can
refer to it at need.
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com