cek browser support

 avatar
user_1215241
javascript
a month ago
775 B
13
Indexable
Never
<script>
    function checkBrowser() {
        const unsupportedBrowserUserAgents = [
            "UCBrowser",
            "MiuiBrowser",
            "OppoBrowser",
            "HeyTapBrowser",
            "SamsungBrowser",
        ];
        const userAgent = navigator.userAgent;

        function isUnsupportedBrowser() {
            for (let i = 0; i < unsupportedBrowserUserAgents.length; i++) {
                if (userAgent.indexOf(unsupportedBrowserUserAgents[i]) !== -1) {
                    return true;
                }
            }
            return false;
        }

        if (isUnsupportedBrowser()) {
            alert("Your browser is not supported. Please use Google Chrome.");
        }
    }

    checkBrowser();
</script>
Leave a Comment