function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PrattyPratty 

How can we find the type of browser we are using

Hi,

 

I have to find the browser type which I am using. 

 

Is there is any method in apex to do this.

 

Thanks in advance.

 

Regards,

 

Pratty

Best Answer chosen by Admin (Salesforce Developers) 
NiketNiket

Hi Pratty ,

 

You can find the browser details by using javascript in your visual force page. Here is the sample code :

 

<apex:page >
<div id="browserid"></div>

<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("browserid").innerHTML=txt;

</script>
</apex:page>

 

Please mark it as the solution if it answers your question and if you have any question, let me know.

 

Ckeck My Blog

All Answers

NiketNiket

Hi Pratty ,

 

You can find the browser details by using javascript in your visual force page. Here is the sample code :

 

<apex:page >
<div id="browserid"></div>

<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("browserid").innerHTML=txt;

</script>
</apex:page>

 

Please mark it as the solution if it answers your question and if you have any question, let me know.

 

Ckeck My Blog

This was selected as the best answer
JitendraJitendra

Hi Pratty,

You can find the browser name and other details using the "User Agent", which can be easily accessed by Javascript.

 

You can find the complete detail at W3School website, Here is URL:

http://www.w3schools.com/js/js_browser.asp

 

Working Demo :

http://www.w3schools.com/js/tryit.asp?filename=try_nav_all

web2000web2000

Check the following example :

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>JavaScript navigator object - appCodeName property example</title>
</head>
<body>
<h1 style="color: red">JavaScript navigator Object : appCodeName property</h1>
<hr />
<script type="text/javascript">
//This is done to make the following JavaScript code compatible to XHTML. <![CDATA[
document.write("navigate appCodeName property : " + navigator.appCodeName);
//]]>
</script>
</body>
</html>

Reference: http://bit.ly/wgu4cX