Chapter 58: ASP Browser Capabilities Component
ASP Browser Capabilities Component
This is the lesson that appears in the W3Schools Classic ASP reference under ASP Components, and it was one of the coolest things for web developers in 1998–2005 because it let you automatically detect what kind of browser the visitor was using — and then show different content, layouts, or features accordingly.
I will explain it like your favorite teacher who actually used Browser Capabilities on real client sites in the early 2000s (when detecting Netscape 4 vs IE 5 vs mobile browsers was a daily headache) — slowly, clearly, with real working examples, good habits, common mistakes, why it became obsolete, and why some legacy Indian government/intranet/ERP systems still rely on it in 2026.
1. What is the Browser Capabilities Component?
The Browser Capabilities component (usually called browscap) is a built-in ASP component that reads the browser’s User-Agent string (sent automatically in every HTTP request) and tells you detailed information about the browser:
- Name (IE, Netscape, Firefox, Chrome, Safari, Opera…)
- Version number
- Platform (Windows, Mac, Linux…)
- Whether it supports:
- Frames
- Tables
- JavaScript
- VBScript
- Cookies
- ActiveX
- Java applets
- CSS
- Background sounds
- Channels (old push tech)
- VB Script
- And many other old-school features
It was extremely useful in the late 90s / early 2000s because:
- Browsers behaved very differently (Netscape 4 vs IE 5 vs early mobile phones)
- Web standards were weak → you had to serve different HTML/CSS/JS to different browsers
- Mobile browsing was emerging (WAP, early PDA phones) → you needed to detect tiny screens, no JavaScript, etc.
2. How It Works — The Two Main Parts
- browscap.ini file A text file on the server that contains a huge list of User-Agent strings + capabilities. IIS reads this file to match the incoming User-Agent.
- BrowserType object In your ASP code, you create it with Server.CreateObject(“MSWC.BrowserType”) It automatically matches the current request’s User-Agent against browscap.ini and gives you properties.
Default location of browscap.ini (on Windows Server/IIS):
|
0 1 2 3 4 5 6 |
C:\Windows\System32\inetsrv\browscap.ini |
(or sometimes C:\inetpub\AdminScripts\browscap.ini)
Important: This file was regularly updated by Microsoft until ~2008–2010. After that, it became outdated very fast because new browsers (Chrome, mobile Safari, Firefox updates) were not added.
3. Basic Example – Detect Browser & Show Different Messages
|
0 1 2 3 4 5 6 |
<%@ Language=VBScript %> <% Option Explicit %> <!DOCTYPE html> <html> <head> <title>Browser Capabilities Demo</title> </head> <body> <h2>Your Browser Information</h2> <% Dim browser Set browser = Server.CreateObject("MSWC.BrowserType") Response.Write "<p><strong>Browser:</strong> " & browser.Browser & "</p>" Response.Write "<p><strong>Version:</strong> " & browser.Version & "</p>" Response.Write "<p><strong>Full Version:</strong> " & browser.MajorVer & "." & browser.MinorVer & "</p>" Response.Write "<p><strong>Platform:</strong> " & browser.Platform & "</p>" Response.Write "<hr>" If browser.Frames Then Response.Write "<p>Frames: Yes ✅</p>" Else Response.Write "<p>Frames: No ❌ (very old browser)</p>" End If If browser.Tables Then Response.Write "<p>Tables: Yes ✅</p>" Else Response.Write "<p>Tables: No ❌</p>" End If If browser.Cookies Then Response.Write "<p>Cookies: Yes ✅</p>" Else Response.Write "<p>Cookies: No ❌ (very rare today)</p>" End If If browser.JavaScript Then Response.Write "<p>JavaScript: Yes ✅</p>" Else Response.Write "<p>JavaScript: No ❌</p>" End If If browser.BackgroundSounds Then Response.Write "<p>Background Sounds: Yes (old IE feature)</p>" End If If browser.VBScript Then Response.Write "<p>VBScript: Yes (classic IE only)</p>" End If Set browser = Nothing %> </body> </html> |
What you see (depending on your browser in 2026):
- Browser: Chrome
- Version: 130.0
- Platform: Win32
- Frames: Yes
- Tables: Yes
- Cookies: Yes
- JavaScript: Yes
- VBScript: No (Chrome never supported VBScript)
4. Real-World Example – Serve Different Content Based on Browser
|
0 1 2 3 4 5 6 |
<% Dim browser Set browser = Server.CreateObject("MSWC.BrowserType") If browser.Browser = "IE" And CInt(browser.MajorVer) < 6 Then ' Old IE 5.x — serve simple version Response.Write "<p style='color:orange;'>You are using an old version of Internet Explorer.</p>" Response.Write "<p>Please upgrade for better experience.</p>" ElseIf InStr(LCase(browser.Platform), "mac") > 0 Then Response.Write "<p style='color:blue;'>Mac user detected! Special Mac layout coming soon...</p>" ElseIf browser.IsMobile Then ' Not always reliable, but was used Response.Write "<p style='color:green;'>Mobile device detected — showing simplified view.</p>" Else Response.Write "<p>Modern browser detected — full experience enabled!</p>" End If Set browser = Nothing %> |
5. Security & Best Practice Warnings (Critical in 2026)
- browscap.ini is outdated — Microsoft stopped updating it around 2008–2010 → Chrome, modern Firefox, Edge, Safari mobile, all new Android/iOS browsers → not recognized → Most properties return default/fallback values → unreliable
- User-Agent can be faked — anyone can send any User-Agent string → Never use for security (e.g. “only allow IE” checks) → Only use for progressive enhancement (better experience if supported)
- Do not rely on it for mobile detection — use modern methods (CSS media queries, JavaScript navigator.userAgent + feature detection)
- In 2026 legacy code → still used in very old systems for simple “IE vs others” checks or logging, but almost never for real decisions
6. Teacher Summary – ASP Browser Capabilities Component in Classic ASP
ASP Browser Capabilities Component (MSWC.BrowserType) is:
- A built-in COM object that matches the browser’s User-Agent string against browscap.ini
- Gives you properties like Browser, Version, MajorVer, MinorVer, Platform, Frames, Tables, Cookies, JavaScript, VBScript, BackgroundSounds, etc.
- Created with Server.CreateObject(“MSWC.BrowserType”)
- Used for: serve different HTML/CSS/JS to old browsers, simple mobile detection (unreliable), logging browser stats
- Was revolutionary 1998–2005 when browsers were very different
- Very unreliable today because browscap.ini is frozen since ~2008–2010
- Still exists in many legacy Indian internal/intranet/government/ERP systems for simple compatibility checks
This is how millions of Classic ASP sites tried to give “browser-specific experiences” — and some very old Indian systems still use exactly this BrowserType object pattern in 2026 (usually with sad results).
Next class?
- Want a full example with different layouts for old IE vs modern browsers?
- Or how to update/maintain browscap.ini manually (people did this)?
- Or compare Classic ASP Browser Capabilities vs modern navigator.userAgent + feature detection?
- Or move to the next W3Schools topic (ASP Content Linking or ASP Content Rotator)?
Just tell me — I’m here! 🚀🇮🇳 Keep learning strong, Webliance! 😊
