How do I detect the browser from the server?

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?

EDIT
Server:

2

2 Answers

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>";
document.getElementById("example").innerHTML=txt;
</script>

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

4

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")
response.write(user_agent)
%>

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like