HOW TO DETECT BROWSER NAME WITH JQUERY

Alex Leblois

Total Post:67

Points:471
Posted by  Alex Leblois
 1183  View(s)
Ratings:
Rate this:
i'm want to Get Browser Name with help of JQuery
  1. Kamlakar Singh

    Post:194

    Points:1396
    Re: How to Detect Browser Name With JQuery

    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>

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!