Jump to content

Screen resolution capture from visitors


hjvanes

Recommended Posts

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

Link to comment
Share on other sites

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'];
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.