Using jQuery we can easily check browsers. Here's how to do it in the Chrome and Firefox example.







Example jQuery to check Browsers

code:





<div id="box"></div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){

var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
var is_firefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;

if(is_chrome){
$("#box").text("Browser is Chrome");
}
else if(is_firefox){
$("#box").text("Browser is Firefox");
}
else {
$("#box").text("unknown");
}
});
</script>









Privacy Policy