Home > DeveloperSection > Forums > How to Detect Browser Name With JQuery
Alex Leblois
Alex Leblois

Total Post:67

Points:471
Posted on    September-22-2014 4:21 AM

 JQuery JavaScript  JQuery 
Ratings:


 1 Reply(s)
 831  View(s)
Rate this:
i'm want to Get Browser Name with help of JQuery


Kamlakar Singh
Kamlakar Singh

Total Post:194

Points:1396
Posted on    September-22-2014 4:25 AM

Hi Alex Leblois i'm try to get browser name with JQuery i think Helpful for you

Here is my Html Code:

<h2 id="browsernmae"></h2>

Here is Jquery Code:

<script src="~/script/jquery-2.1.0.min.js"></script>

<script>
    jQuery(document).ready(function () {

        var browserName = navigator.appName;
        var nAgt = navigator.userAgent;
        if ((verOffset = nAgt.indexOf("Chrome")) != -1) browserName = "Chrome";
        else if ((verOffset = nAgt.indexOf("MSIE")) != -1) browserName = "Microsoft Internet Explorer";
        else if ((verOffset = nAgt.indexOf("Safari")) != -1) browserName = "Safari";
        else if ((verOffset = nAgt.indexOf("Firefox")) != -1) browserName = "Firefox";
        var opera = (navigator.userAgent.match(/Opera|OPR\//) ? true : false);
        if (opera == true)browserName = "Opera";

        $("#browsernmae").html("Browser Type = " + browserName);
    });
</script>

Don't want to miss updates? Please click the below button!

Follow MindStick