ASP 101 - Active Server Pages 101 - Web04
The Place ASP Developers Go!

Please visit our partners


Windows Technology Windows Technology
15 Seconds
4GuysFromRolla.com
ASP 101
ASP Wire
VB Forums
VB Wire
WinDrivers.com
internet.commerce internet.commerce
Partners & Affiliates














ASP 101 is an
internet.com site
ASP 101 is an internet.com site
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash



 Top ASP 101 Stories Top ASP 101 Stories
Getting Scripts to Run on a Schedule
The Top 10 ASP Links @ Microsoft.com
What is Adovbs.inc and Why Do I Need It?

QUICK TIP:
Basic Authentication at its Most Basic
Show All Tips >>
ASP 101 RSS Feed ASP 101 Updates


Quick Tips


Utilize browser capabilities
To give your site the broadest reach, build your Web pages for the lowest common denominator. HTML 3.2 is typically a safe bet. Only if you know that your end users have a 4.0 browser should you use such features as Dynamic HTML to deliver a more powerful experience. You should query the browser capabilities of your visitors using the browser capabilities ASP object (MSWC.BrowserType). This component creates a BrowserType object that provides your scripts with the capabilities of the browser viewing them.

Start by creating an instance of the BrowserType object:

<HEAD>
<META name="generator" content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY><STRONG></STRONG>
<%Set bcObj = Server.CreateObject ("MSWC.BrowserType")%>


Now create a table and output four properties of the BrowserType: the browser name, the version number, and whether it supports VBScript and JavaScript.

<TABLE border="1" cellpadding="1" cellspacing="1" width="75"%>
<TR>
<TD><STRONG>Feature</STRONG>
<TD><STRONG>Included</STRONG>
<TR>
<TD><STRONG></STRONG>Browser
<TD><%= bcObj.browser%>
<TR>
<TD>Version
<TD><%= bcObj.version%>
<TR>
<TD>
<P>VBScript</P>
<TD><%= bcObj.vbscript%>
<TR>
<TD>
JavaScript
<TD><%= bcObj.javascript%>
</TR></TABLE>

<P> </P>

</BODY>
</HTML>

Non-VB programmers should note that -1 is a Boolean true value, so if a browser supports VBScript, the above code will return -1 to indicate that.

In your server-side ASP code you can use these browser properties to generate the appropriate HTML and client-side script depending on the user's browser.
Previous      Show All Tips      Next

If you have a tip you would like to submit, please send it to: webmaster@asp101.com.


Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers