Device detector by javascript

<!DOCTYPE html>

<html>

    <head>

        <title>Device Detection</title>

        <body>

            <label id="detect"></label>

            <input type="button" value="detect Device" onclick="detect()">

            <script>

                function detect()

                {

                var detect = document.getElementById('detect');

                if(navigator.userAgent.match(/Windows/i))

                {

                    detect.innerHTML="It's Window";

                    //alert("It's windows");

                }

                else if(navigator.userAgent.match(/Android/i))

                {

                    detect.innerHTML="It's Android";

                }

                //alert("It's work");


                }


                

            </script>

        </body>

    </head>

</html>

Device Detection

Comments