There is no native function in PHP that can detect the display resolution. Webmaster insights will help to solve this problem arising in PHP. Java script can be used in this case, which will detect the display resolution. The script will do so, by using the width and height features of the screen. The required code for this has to be inserted into a HTML document. Once it is done, the settings can be switched to the PHP script through proper coding methods.
There is no native function in PHP for detecting a user's display resolution.
You can, however, use Javascript to discover the resolution through the width and height attributes of the screen:
screen.width screen.height
The following Javascript code will show the display resolution:
<script language="Javascript"> <!-- document.write('<br>your resolution is'.screen.width+'x'+screen.height) //--> </script>
It is possible to convert this to PHP code like this:
<? if(!isset($_GET['r'])) { echo "<script language=\"JavaScript\"> <!-- document.location=\"$PHP_SELF?r=1&width=\"+screen.width+\"&Height=\"+screen.height; //--> </script>"; } else { // Code to be displayed if resolutoin is detected if(isset($_GET['width']) && isset($_GET['Height'])) { // Resolution detected } else { // Resolution not detected } } ?>
Webmaster
- Php get screen width
- Php screen width
- Php detect screen size
- Creator studio white screen [solved] > Forum - Facebook
- Lg dual screen tv > Guide
- Facebook white screen [solved] > Forum - Facebook
- Https //m.facebook.com/home.php soft=bookmarks log out [solved] > Forum - Facebook
- Https //m.facebook.com/home.php _rdr log out > Forum - Facebook
- HTML table fit to screen: height, width
- How to resolve unexpected T_STRING error in PHP
- How to solve undefined index error in PHP: $ _GET, $ _POST
- Remove border of image: CSS, HTML
- How to change text color input box HTML
- Unicode reverse text: character, direction
- Parse error in PHP: syntax error, unexpected $end
- PHPmyadmin access denied: for user 'root'@'localhost'
- How to create a transparent DIV in CSS