0

Angularjs scripts are not working on some old browsers so I want to redirect users who use these old browsers. How can I understand angular is working or not in client browsers.

maskapsiz
  • 244
  • 5
  • 23

2 Answers2

0

Since Angular 1.3, support for IE8 and below was dropped

AngularJS 1.3 has dropped support for IE8. Read more about it on our blog. AngularJS 1.2 will continue to support IE8, but the core team does not plan to spend time addressing issues specific to IE8 or earlier.

you can access the user agent information like so

$window.navigator.userAgent;

check out this question: How to detect browser using angular?

Community
  • 1
  • 1
svarog
  • 9,477
  • 4
  • 61
  • 77
0

I'm using this script to detect browser and redirect.

    $(function() {

    var BrowserDetect = {
            init: function () {
                this.browser = this.searchString(this.dataBrowser) || "Other";
                this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "Unknown";
            },
            searchString: function (data) {
                for (var i = 0; i < data.length; i++) {
                    var dataString = data[i].string;
                    this.versionSearchString = data[i].subString;

                    if (dataString.indexOf(data[i].subString) !== -1) {
                        return data[i].identity;
                    }
                }
            },
            searchVersion: function (dataString) {
                var index = dataString.indexOf(this.versionSearchString);
                if (index === -1) {
                    return;
                }

                var rv = dataString.indexOf("rv:");
                if (this.versionSearchString === "Trident" && rv !== -1) {
                    return parseFloat(dataString.substring(rv + 3));
                } else {
                    return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
                }
            },

            dataBrowser: [
                {string: navigator.userAgent, subString: "Chrome", identity: "Chrome"},
                {string: navigator.userAgent, subString: "MSIE", identity: "Explorer"},
                {string: navigator.userAgent, subString: "Trident", identity: "Explorer"},
                {string: navigator.userAgent, subString: "Firefox", identity: "Firefox"},
                {string: navigator.userAgent, subString: "Safari", identity: "Safari"},
                {string: navigator.userAgent, subString: "Opera", identity: "Opera"}
            ]

        };

        BrowserDetect.init();

        var browser_url = urlHolder.baseUrl + "browser_update/?browser=" + BrowserDetect.browser + "&version=" +BrowserDetect.version;

        if (BrowserDetect.browser == "Chrome") {
            if (BrowserDetect.version <= "30")
                document.location.href = browser_url
        } else if (BrowserDetect.browser == "Explorer") {
            if (BrowserDetect.version <= "10")
                document.location.href = browser_url
        } else if (BrowserDetect.browser == "Firefox") {
            if (BrowserDetect.version <= "25")
                document.location.href = browser_url
        }
});
maskapsiz
  • 244
  • 5
  • 23