Javascript - How to find users screen size and resolution, Detect users screen size and screen resolution
How to find users screen size and resolution
Many people use different hardware/pc for accessing online applications. In this growing trend web application are presented for web users depending upon their screen size, By using the below coed you can find the screen size od the device used by the user.<?php if(isset($_COOKIE["deviceResolution"])) { $urScreenRes = $_COOKIE["deviceResolution"]; } //set cookie using Javascript to get screen width and height else { ?> <script language="javascript"> checkScreenRes(); function checkScreenRes() { var exdate=new Date(); exdate.setDate(exdate.getDate() + 365); var screenWidth = screen.width +"x"+ screen.height; var c_value=screenWidth + "; expires="+exdate.toUTCString(); document.cookie= 'deviceResolution=' + c_value; } </script> <?php } echo "Your screen resolution is ". $urScreenRes; ?>
The topic on Javascript - How to find users screen size and resolution is posted by - Guru
Hope you have enjoyed, Javascript - How to find users screen size and resolutionThanks for your time