Detect Browser Script
Identify the client. This script runs a series of checks on the `navigator.userAgent` string to guess which browser the user is currently running.
You appear to be using:
Unknown
Based on User Agent analysis
Copy the Script
<script>
function getBrowser() {
var userAgent = navigator.userAgent;
var browserName;
if(userAgent.match(/chrome|chromium|crios/i)){
browserName = "Chrome";
}else if(userAgent.match(/firefox|fxios/i)){
browserName = "Firefox";
} else if(userAgent.match(/safari/i)){
browserName = "Safari";
} else if(userAgent.match(/opr\//i)){
browserName = "Opera";
} else if(userAgent.match(/edg/i)){
browserName = "Edge";
} else {
browserName = "Unknown/Other";
}
document.write("Browser: " + browserName);
}
getBrowser();
</script>
Frequently Asked Questions
Browsers often lie. For example, Chrome's User Agent string includes the word 'Safari'. You have to check for specific unique tokens in a strict order to get it right.
Yes. For coding (e.g., 'Does this browser support 3D?'), always check for the feature itself. Use this script only for analytics or displaying info to the user.
Yes, typically by looking for the 'OPR' or 'Opera' string in the user agent.