Determining screen resolution
Posted: Wed Dec 01, 2010 5:53 am
I found some code that says it will use javascript to return the resolution the user has, yet it has an odd error that I can't figure out.
Yet in wamp it outputs this, for some reason echoing everything after the script ends.
Code: Select all
<?
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
}
}
?>Code: Select all
; } else { // Code to be displayed if resolutoin is detected if(isset($_GET['width']) && isset($_GET['Height'])) { // Resolution detected } else { // Resolution not detected } } ?>