Chapter 14. Browser Capabilities Component
One of the challenges of constructing a useful web site today is determining what your users' browsers can and cannot interpret in the form of content. Generally, if you know the browser the current user is using, you know its base capabilities. For example, you know that if the user is using Netscape Navigator, then he must have an ActiveX plug-in to use ActiveX controls. However, what if the client is using a less well-known browser? Can you be sure the browser even supports cookies?
In an attempt to help with this problem, Microsoft introduced the
Browser Capabilities component. You use the Browser Capabilities
component to create a BrowserType object. When you create a
BrowserType object, the web server retrieves the
HTTP_USER
_AGENT
header
sent by the client. Using this information, the BrowserType object
compares the information from this header to entries in a special
file (BrowsCap.ini ). If a match for the current
client's browser is found, the BrowserType object determines
all the properties for the specific browser. Your scripts can then
reference the properties of the BrowserType object to determine the
capabilities of the user's browser. The following steps
summarize this process:
The browser requests a page from the web server. That page contains an instantiated BrowserType object. The browser sends an
HTTP_USER_AGENT
request header. For example:Mozilla/4.0 (compatible; MSIE 5.0; Windows 98)
The BrowserType object looks this ...
Get ASP in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.