📄 asp_browser.asp@output=print
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ASP Browser Capabilities</title>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />
<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</head>
<body>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
<h1>ASP Browser Capabilities Component</h1>
<a href="asp_adrotator.asp"><img alt="previous" border="0" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="asp_contentlinking.asp"><img alt="next" border="0" src="../images/btn_next.gif" width="100" height="20" /></a>
<hr />
<h2>Examples</h2>
<p><a target="_blank" href="showasp.asp@filename=demo_browsercap">The Browser Capabilities Component</a><br />
This example shows how to determine the type, capabilities and version
number of each browser
visiting your site.</p>
<hr />
<h2>ASP Browser Capabilities Component</h2>
<p>The ASP Browser Capabilities component creates a BrowserType object that determines the type, capabilities and version
number of each browser
that visits your site.</p>
<p>When a browser connects to a server, an HTTP User Agent Header is also sent
to the server. This header contains information about the browser (like browser
type and version number). The BrowserType object then compares the information
in the header with information in a file on the server called "Browscap.ini".</p>
<p>If there is a match between the browser type and version number sent in the
header and the information in the "Browsercap.ini" file, you can use the BrowserType object
to list the properties of the matching browser.
If there is no match for the browser type and version number in the Browscap.ini file, it
will set every property to
"UNKNOWN".</p>
<h3>Syntax</h3>
<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3">
<tr valign="top">
<td><%<br />
Set MyBrow=Server.CreateObject("MSWC.BrowserType") <br />
%></td>
</tr>
</table>
<p>The example below creates a BrowserType object in an ASP file, and displays a table showing
some of the capabilities of the current browser:</p>
<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3">
<tr valign="top">
<td>
<pre><html>
<body></pre>
<pre><%
Set MyBrow=Server.CreateObject("MSWC.BrowserType")
%></pre>
<pre><table border="1" width="100%">
<tr>
<th>Client OS</th>
<th><%=MyBrow.platform%></th>
</tr><tr>
<td >Web Browser</td>
<td ><%=MyBrow.browser%></td>
</tr><tr>
<td>Browser version</td>
<td><%=MyBrow.version%></td>
</tr><tr>
<td>Frame support?</td>
<td><%=MyBrow.frames%></td>
</tr><tr>
<td>Table support?</td>
<td><%=MyBrow.tables%></td>
</tr><tr>
<td>Sound support?</td>
<td><%=MyBrow.backgroundsounds%></td>
</tr><tr>
<td>Cookies support?</td>
<td><%=MyBrow.cookies%></td>
</tr><tr>
<td>VBScript support?</td>
<td><%=MyBrow.vbscript%></td>
</tr><tr>
<td>JavaScript support?</td>
<td><%=MyBrow.javascript%></td>
</tr>
</table></pre>
<pre></body>
</html></pre>
</td>
</tr>
</table>
<p>Output:</p>
<table class="ex" width="100%" border="1">
<tr>
<th>Client OS</th>
<th>WinNT</th>
</tr>
<tr>
<td>Web Browser</td>
<td>IE</td>
</tr>
<tr>
<td>Browser version</td>
<td>5.0</td>
</tr>
<tr>
<td>Frame support?</td>
<td>True</td>
</tr>
<tr>
<td>Table support?</td>
<td>True</td>
</tr>
<tr>
<td>Sound support?</td>
<td>True</td>
</tr>
<tr>
<td>Cookies support?</td>
<td>True</td>
</tr>
<tr>
<td>VBScript support?</td>
<td>True</td>
</tr>
<tr>
<td>JavaScript support?</td>
<td>True</td>
</tr>
</table>
<br />
<hr />
<h2>The Browscap.ini File</h2>
<p>The "Browsercap.ini" file is used to declare properties
and to set default values for
browsers.</p>
<p>This section is not a tutorial on how to maintain "Browsercap.ini" files,
it only shows you the basics; so you get an idea what a "Browsercap.ini" file
is all about.</p>
<p>The "Browsercap.ini" file can contain the following:</p>
<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3">
<tr valign="top">
<td>
<pre>[;comments]
[HTTPUserAgentHeader]
[parent=browserDefinition]
[property1=value1]
[propertyN=valueN]
[Default Browser Capability Settings]
[defaultProperty1=defaultValue1]
[defaultPropertyN=defaultValueN]</pre>
</td>
</tr>
</table>
<br />
<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3">
<tr valign="top">
<th align="left">Parameter</th>
<th align="left">Description</th>
</tr>
<tr valign="top">
<td>comments</td>
<td>Optional. Any line that starts with a semicolon are ignored
by the BrowserType object</td>
</tr>
<tr valign="top">
<td>HTTPUserAgentHeader</td>
<td>Optional. Specifies the HTTP User Agent header to associate with the
browser-property value statements specified in propertyN. Wildcard
characters are allowed</td>
</tr>
<tr valign="top">
<td>browserDefinition</td>
<td>Optional. Specifies the HTTP User Agent header-string of a browser to
use as the parent browser. The current browser's definition will inherit all
of the property values declared in the parent browser's definition</td>
</tr>
<tr valign="top">
<td>propertyN</td>
<td>Optional. Specifies the browser properties. The following table lists some possible properties:<ul>
<li>ActiveXControls - Support ActiveX
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -