Browser detection methods


1. Navigator method:

CODE:
document.write('Browser Type: '+navigator.appName' ');
document.write('Browser Family and Version: '+navigator.appVersion+' ');


  • Navigator alone can't separate incompatible NS 4 from NS 6
    Navigator + version can separate NS4/6 but must be upgraded annually


    2. Family method:

  • familysniffer.htm detect browser by family -- write type
  • familysniffer.js.txt code can distinguish NS4 from NS6 ("gecko") but can't separate IE 4 from IE 5 or IE 6 (all IE 4 family)


    3. Features method:

  • sniffer1.htm detect browser by features -- alertbox
  • browsersniffer.js.txt code distinguishes three levels: 1) IE 5/6 or NS6 (getElementById)-- 2) NS4 (layers) -- 3) IE 4 (all)

  • sniffer2.htm detect browser by features -- redirect demo
  • featuresniffer.js.txt code