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
downloadingdownloading 

How to dispaly the Browsers name

HI,

I wanna display the name of the browser which i am using

and this has to come from the controller

Could anyone help me the sample code

 

ThankYou

Arijit_rArijit_r

Hi,

 

I dont think that you will get the browser name from Controller since they execute in the server side, however you can use javascript (client side script) to get the browser name.

 

Example: navigator.appName or navigator.appCodeName.

downloadingdownloading

HI , 

 

Could you help me with a sample example how to achieve this

using apex  VisualForce

NiketNiket

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