JavaScript how detect mobile device and get screen width

How detect mobile users on web page by javascript and get width users display.

      if (navigator.userAgent.match(/Mobi/)) {
            alert("Mobi");
            var w = screen.width;
            // idTableMain replace with id of main table on your webpage 
            document.getElementById('idTableMain').width = w;
        }
This entry was posted in Android Examples Code, Smartphone and tagged , . Bookmark the permalink.


Comments are closed.



2,273 views