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

Please visit our partners

Windows Technology Windows Technology
15 Seconds
ASP 101
ASP Wire
VB Forums
VB Wire
internet.commerce internet.commerce
Partners & Affiliates

ASP 101 is an site
ASP 101 is an site
Internet News
Small Business
Personal Technology

Corporate Info
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 @
What is and Why Do I Need It?

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:

<META name="generator" content="Microsoft Visual Studio 6.0">
<%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"%>
<TD><%= bcObj.browser%>
<TD><%= bcObj.version%>
<TD><%= bcObj.vbscript%>
<TD><%= bcObj.javascript%>

<P> </P>


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:

Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback
The Network for Technology Professionals



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