Browser Detection
-
Take advantage of the latest features of a broswer without leaving old
browsers behind.
-
Redirect users to pages that are optimized for their browser.
-
Based on the navigator object of the Document Object Model.
-
Attributes of navigator:
-
appCodeName: Mozilla
-
appName: Netscape or Microsoft Internet Explorer. An indexOf("Netscape")
and indexOf("Microsoft") is adequate to detect either-or.
-
userAgent - a string the browser sends to the web server or CGI
script.
-
language - language of the browser
-
platform - Win16, Win32, MacPPC
-
For best results, use with an if statement.
echoecho
example: displaying navigator information
Redirect example
Source
Notes on Browser Detection
Home
Internet II: Day 4