1. Browser Capabilities Component
The main function of this component is to extract version information that recognizes the client browser.
The principle is as follows: When the client browser sends a page request to the server, it will automatically send a User Agent HTTP header, which is an ASCII string declaring the browser and its version. The Browser Capabilities component maps the User Agent to the browser indicated in the file Browscap.ini, and recognizes the client browser through the properties of the BrowserType object.
If the object cannot find an item that matches the title in the browser.ini file, the default browser properties will be used. If the object has neither a match found and the default browser settings are specified in the browser.ini file, it sets each property to the string "UNKNOWN".
By default, the browser.ini file is stored in the WINDOWS/SYSTEM/INERSRV (if 95/98+PWS4) or NT/SYSTEM32/INERSRV (if NT) directory. You can edit this text file yourself to add your own properties or modify the file according to the latest released browser version update file.
It can be concluded that the Browser Capabilities component extracts the contents of a file and compares them to display them. How to apply it specifically?
1, btinfo.asp
| <%set bc=server.CreateObject("mswc.browsertype")%> The browser name is browser: <%=bc.browser%><br> The browser version is version: <%=bc.version%> <br> The main version of the browser is majorver:<%=bc.majorver%> <br> The browser auxiliary version is minorver:<%=bc.minorver%> <br> The browser's running platform is platform: <%=bc.platform%> <br> |
Obviously, "<%set bc=server.CreateObject("mswc.browsertype")%>" is the creation of browser components.
The following, such as "bc.browser", is to display a specific feature of the browser.
2, btif.asp
| <%set bc=server.CreateObject("mswc.browsertype")%> <%if bc.frames=true then%> The browser supports multi-window (frames) display <%else%> The browser does not support multi-window (frames) display <%end if%> <br> <%if bc.backgroundsounds=true then%> The browser can play background music (backgroundsounds) <%else%> The browser cannot play background music (backgroundsounds) <%end if%> <br> <%if bc.tables=true then%> Browser support tables display <%else%> The browser does not support tables display <%end if%> <br> <%if bc.beta=true then%> Your browser is a beta version (beta) <%else%> Your browser is an official version <%end if%> <br> <%if bc.activexcotrols=true then %> Browser supports active control <%else%> The browser does not support active control <%end if%> <br> <%if bc.cookies=true then%> Browser supports cookie function <%else%> The browser does not support cookie function <%end if%> <br> <%if bc.vbscript=true then%> Browser supports vbscript <%else%> The browser does not support vbscript <%end if%> <br> <%if bc.jscript=true then%> Browser supports jscript <%else%> The browser does not support jscript <%end if%>
|