SiteExperts.com Logo Home | Community | Developer's Paradise
User Groups | Site Tools | Site Information | Search
 Main Menu
 Resource

Backend Browser Detection

Categories...
Client User Group
Write Once!
Language
JavaScript, VBScript
Product
IE3, IE4, IIS, NS3, NS4
Server User Group
Active Server Pages
Task
Browser Detection, Cross-Browser DHTML
Technology
Server Scripting

Sponsored Links
Developer's Paradise : Inside Technique :
Backend Browser Detection
Submission by SiteExperts Staff

Go to the resource:
Backend Browser Detection

Add to Assistant

Short Description
Using server-side browser detection, you can quickly customize pages for individual browsers.

Long Description
Using server-side browser detection, you can quickly customize pages for individual browsers.

Author
Scott Isaacs
Submission URL
http://www.SiteExperts.com/tips/backend/ts02/page1.asp
Submission Date
Mar 26,1998
 

Discussion and Rate this Resource
Overall Rating: 3.2

fauve on Feb 23, 2000 at 2:55:23 PMRating: 3
What about ISP's that cache webpages for their clients? I believe this is the biggest flaw with detecting browsers on the server.
Robert Dyball on Oct 6, 1999 at 7:45:55 PMRating: 2

Since browscap.ini changes every 5 minutes, as soon as a new browser or version/update, it is potentially useless, the use of server side browser detection is of limited use.

Sometimes using server side detection is fine but you need to use Request.ServerVariables to get it right too, eg., recently I needed to make a page that detected our own customised version of IE or Netscape,and since this is pretty well fixed

Detecting the version of the browser at the client, using Javascript, and passing this back to the server is IMO the preferable way for many other places.  even here, I find a lot of people come unstuck, using built in objects in Javascript can also be less than reliable, instead I prefer to use detection based upon capabilities. eg.,

if (document.layers) isNS = true;
if (document.all) isIE = true;

(give or take) this tests based on what the browser can or cannot do, and likely to be longer lasting, living through inevitable browser changes.

To get this back to the server, all you need do is update a hidden form field, or add it to the querystring. eg.,

  is_ns = (document.layers)? true:false
  is_ie = (document.all)? true:false
 if (!is_ie && is_ns) {
   for (i=0; i < navigator.plugins.length; i++) {
     if (navigator.plugins[i].name == "NNPE Account Setup Plugin")
       theForm.show_auto_configure.value = "true";
   }
 }

This does a little more, detecting some plug ins i needed to find as well. the HTML side of it is simply a hidden field.

<input type="HIDDEN" value="false" name="show_auto_configure">

Then back on the server you simply do a request.form.

cheers,
Robert Dyball

 

choiwahchow on Apr 2, 1999 at 7:22:13 PMRating: 1

You missed one very important component in your article about brower detection on the server side:  one file (can't remember the name of it) which keeps all browser types need to be up-to-date!

So we prefer to detect the brower on the client-side and send it to the server as part of the form or url.

Bart on Mar 19, 1999 at 6:38:09 AMRating: 3

This site is a great resource and the possibility to react on the articles is awesome. The article itself is not bad, but I found that the BrowserCaps object isn't perfect. That means that it doesn't correctly detect every browser (even browsers from MS). I think cause it's based on what the HTTP_USER_AGENT returns and this return I found is not always correct. For example a System with MS IE 2.0 installed, returns on Server site the caps of IE4. So what I normally do, is detect the Browser on Clientside (whether it's Version or Caps doesn't really matter) and post this to Serverside in a form to the Server. From the Serverside you then can write it to a Cookie, an ASP Session or a Database for later use. Depending on your application.

Greetings,

Bart van Langen

 



To rate and comment on a resource, you must first logon.

If you are not registered, please register yourself to become a member of the SiteExperts.community.

User Name
Password

Copyright © 1997-2008 InsideDHTML.com, LLC. All rights reserved.