User agent - customizable server-side identification of your application

 

 

Applies to:
Working with BrowserBob

The user agent of a browser is the code transmitted by the browser to the webserver, from which  you are loading the requested page. The browser identifies itself by transmitting its name, version number and operating system
of the computer. A BrowserBob application, whether it actually is a browser or not, will send this identifier to any webserver as well. You can customize the identification string and use it for access control or content management of your application. This enables you to serve special pages for users of your application for example, as they are identifiable by this simple means.

Microsoft Internet Explorer 6.0 running under Windows 2000 typically identifies itself like follows:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; )

 

 

 

 

 

With BrowserBob you can extend this identification string with a value of your choice.

Example:
If you enter into the user agent field the string "testagent", this application will identify itself as:

 

 

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; testagent;)

This can be very interesting for several reasons: first of all you track users of your browser in your website statistics, so you get easy tracking statistics for the effectiveness of your browser promotion / usage. Secondly - and this is an even more interesting feature - you can provide exclusive parts of your website for users of your browser by checking this custom user agent string. So you can give users of your special browser access to restricted content via the browser you give them. Providing exclusive offers or special content for browser users is a very good incentive to make them use your custom application...

You can also leave your fingerprint wherever users of your app surf to by entering your webaddress as user agent string: www.browserbob.com which will generate even more attention for your business.

Server side identification of special user agents
can be done using Java Script for example (see below).
 

You can identify custom user agents and forward them to a special page via standard scripts, which you would also use in order to identify netscape users for example:

  • JavaScript: via using the "navigator" object.
  • CGI-Script: via checking of the variable HTTP_USER_AGENT
  • Server Side Includes: via checking of the variable HTTP_USER_AGENT

For standard incentives and exclusive user content, which does not need to meet high security standards, you can realize this user agent checking quickly via some lines of Java Script. Should you wish to protect your special content using high security standards, you should identify the user agent not via your HTML - Code but from the server, using SSI (Server Side Includes) for example.

 

Example: Java Script code for user agent identification and forwarding

Insert the following Java Script code into the HEAD area of your html page to identify users of your application. In our example the user agent is "testagent" - then lead users of this application to the exclusive page "start.html":
   
<html>
<head>
<title>page title</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="JavaScript">
<!-- // Agent-Sniffer
if (navigator.appVersion.indexOf("testagent") != -1){window.location = "start.html";}
//-->
</script>


</head>
<body bgcolor="#FFFFFF">

</body>
</html>
!

 

 

 

 

 

 

The user agent is only active during the runtime of a finished application, it's not active in testmode! So there is no way for you to test the functionality of your browser identification nor your respective identifying html or SSI code without compiling your application. You can test this only with a finished (build) application.

 

Related topics:
Main Dialog object
Main Dialog properties