I'm trying to get this javascript code to display simply the name of the browser I am using to display the web page. I am using safari and none of the navigators display the fact that I am running safari. On my browser, it displays the following:
Name: Netscape Code name: Mozilla Product: Gecko Version: 5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8 Platform: MacIntel User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8
How can I get the script to display what browser the client is using? I've read from other posts that navigator.appName achieves this, but it doesn't since Netscape is not the name of the browser; Safari in my case is.
function BrowserIdentity() {
document.getElementById("browser-detection").innerHTML = "Name: " + navigator.appName + "<br>Code name: " + navigator.appCodeName +"<br>Product: " + navigator.product + "<br>Version: " + navigator.appVersion + "<br>Platform: " + navigator.platform + "<br>User agent: " + navigator.userAgent;
}
<h3>Navigator Details</h3>
<p>Click the button to display navigator details:</p>
<button onClick="BrowserIdentity()">Click Me</button>
<p id="browser-detection"></p>