hjvanes Posted September 16, 2011 Share Posted September 16, 2011 Hello PHPers, One more help I think may be wrong. I currently have code as $_GET['width'] . "x" . $_GET['height'];. This provides continually with 640 * 480. believe this to be incorrect as I do not think that everyones screen is set to this. Neither is my screen resolution and is still capturing these figures. Is there something wrong with the variable that should be changed so that it can pick up the visitors screen resolution. Thank you kindly, HJ Quote Link to comment https://forums.phpfreaks.com/topic/247238-screen-resolution-capture-from-visitors/ Share on other sites More sharing options...
premiso Posted September 16, 2011 Share Posted September 16, 2011 Where is that coming from? Javascript? PHP on it's own cannot detect screen resolution, at least as far as I know. Quote Link to comment https://forums.phpfreaks.com/topic/247238-screen-resolution-capture-from-visitors/#findComment-1269769 Share on other sites More sharing options...
btherl Posted September 16, 2011 Share Posted September 16, 2011 I've seen screen.width, screen.height and screen.colorDepth used in javascript to find screen size and color depth. You would need to then send that information to PHP. Quote Link to comment https://forums.phpfreaks.com/topic/247238-screen-resolution-capture-from-visitors/#findComment-1269771 Share on other sites More sharing options...
voip03 Posted September 16, 2011 Share Posted September 16, 2011 Get the users resolution using JavaScript and then set a cookie which has the users resolution, we can then access that cookie in PHP! Quote Link to comment https://forums.phpfreaks.com/topic/247238-screen-resolution-capture-from-visitors/#findComment-1269800 Share on other sites More sharing options...
voip03 Posted September 16, 2011 Share Posted September 16, 2011 OR You could just pass the resolution from a Javascript page using $_GET which is less attractive but easier. <?php if( empty($_GET['w'] )) { ?> <script type="text/javascript"> window.location.href = '1002.php?w=' + screen.width + '&h=' + screen.height; </script> <?php } else { echo "Your screen resolution is set at ". $_GET['w']. " X " . $_GET['h']; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/247238-screen-resolution-capture-from-visitors/#findComment-1269990 Share on other sites More sharing options...
xyph Posted September 16, 2011 Share Posted September 16, 2011 Why would server-side scripts ever care about a user's screen resolution? You're going to have to somehow pass this information to PHP via JavaScript. This won't be possible without reloading your script in some way. Quote Link to comment https://forums.phpfreaks.com/topic/247238-screen-resolution-capture-from-visitors/#findComment-1270070 Share on other sites More sharing options...
Drummin Posted September 16, 2011 Share Posted September 16, 2011 I use JS to send resolution via GET to a "ping" page that grabs the details, saves the info to the users profile then directs them to their home page. This "processing" happens so fast you never see the ping url with the get values. Quote Link to comment https://forums.phpfreaks.com/topic/247238-screen-resolution-capture-from-visitors/#findComment-1270081 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.