By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,605 Members | 2,129 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,605 IT Pros & Developers. It's quick & easy.

how do we capture the browser ??

P: 1
Expand|Select|Wrap|Line Numbers
  1. var elm = getElmById("myID"); 
  2.  
  3. function getElmById(aID){ 
  4.   var element = null; 
  5.  
  6.   if (isMozilla || isIE5) 
  7.     element = document.getElementById(aID) 
  8.   else if (isNetscape4) 
  9.     element = document.layers[aID] 
  10.   else if (isIE4) 
  11.     element = document.all[aID]; 
  12.  
  13.   return element; 
  14.  
here how do we capture the browser, wheather its mozilla or IE
isMozilla or isIE5 are variables...??
can you help me in how to check for a particular browser.
Sep 13 '06 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
Two points:
  1. Don't use browser detection. Use object detection instead - see, for example, this link.
  2. If you must use browser detection, then use the Navigator object which contains information about the client browser.
May 13 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.