JSFiddle - React, Tailwind, and code Playground

detect browser

by Peter A

HTML

<div id="example"></div>

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;


var detect = navigator.userAgent;
alert("You're using: "+detect);