Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using a lightweight server that does basic serving of pages and doesn't have a api call for browser detection (like in ASP.NET, for example).

What is the best way to go about finding what browser the user is using?

Just parse the request header or is there some other way?


share|improve this question
What server are you using? – Adam Prax May 5 '11 at 18:20
@Adam, see edit – Tommy May 5 '11 at 18:28

According to the information in the link you provided, your webserver supports classic ASP.

You can use ASP to grab and parse the user agent string to determine the client's browser.

user_agent = request.servervariables("HTTP_USER_AGENT")
share|improve this answer

If the user requests the page that is present on the server, then you can write your own Browser Detection Script. It can be in any language, Javascript, C# .Net, Or JSP etc.,

Here is the sample, that is in Javascript:

<script type="text/javascript">

txt = "<p>Browser CodeName: " + navigator.appCodeName + "</p>";
txt+= "<p>Browser Name: " + navigator.appName + "</p>";
txt+= "<p>Browser Version: " + navigator.appVersion + "</p>";
txt+= "<p>Cookies Enabled: " + navigator.cookieEnabled + "</p>";
txt+= "<p>Platform: " + navigator.platform + "</p>";
txt+= "<p>User-agent header: " + navigator.userAgent + "</p>";



try pasting this in the html of the page. Then this will detect the browser. If you need any, do comment

share|improve this answer
what can I do on the server side with this? Do I parse it? Thank you. – Tommy May 5 '11 at 18:33
This doesn't seem to be what the OP is looking for. He wants to determine the browser on the server-side, rather than on the client-side. Javascript is run inside the user's browser, not by the server. – Adam Prax May 5 '11 at 18:56
On your server, you will be having HTML Pages right. Embed this code into the HTML Page. This will be detecting the Browser. So once you detect the browser, you can proceed. Your Que says, "What is the best way to go about finding what browser the user is using?" So here is the solution. You have find out the user browser. ! – MoG May 5 '11 at 18:56
@Adam Parx: To detect the browser of the client, client needs to request from the server initially, lets say, user requested the above javascript containing html page. Now as soon as the page is loaded, postback the page data to Server. Bingo, you have detected the user browser. – MoG May 5 '11 at 18:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .