Hosting Solutions
mobile_logo Table of Contents

How to Detect User Browser JavaScript Tutorial

Learn how to detect the user browser software using JavaScript. There are various different ways to go about obtaining the result. This script is written to best convey the logic to someone new to programming. We also make special considerations for modern versions of Internet Explorer browser detection in this exercise.

example.html <script> var ba = ["Chrome","Firefox","Safari","Opera","MSIE","Trident","Edge"]; var b, ua = navigator.userAgent; for(var i=0; i < ba.length; i++){ if( ua.indexOf(ba[i]) > -1 ){ b = ba[i]; break; } } if(b == "MSIE" || b == "Trident" || b == "Edge"){ b = "Internet Explorer"; } alert("You are using " + b + " browser"); </script>

JavaScript Videos

Array Programming

Typing Text Animation Tutorial Array Loop ProgrammingHow to Detect User Browser JavaScript TutorialArray Slideshow Animation TutorialGet or Remove Random Array Elements TutorialAlphabetic Search First Letter A to Z Script Tutorial PHP MySQLMemory Game Programming TutorialMultidimensional Array Programming TutorialExam Application Programming Tutorial Quiz Online TestFisher Yates Shuffle Modern Algorithm Array Programming Tutorial