PHP does not provide a function to detect the screen resolution for displaying information about the visitor is not provided natively by the HTTP protocol. by Javascript to detect against the resolution through the width and height attributes of the object screen:
Quote:
screen.width
screen.height
|
Thus the following code, when inserted into an HTML document, displays the display resolution of the visitor:
Quote:
<script language="Javascript">
<! -
document.write ('simply enter your resolution is'. screen.width + 'x' + screen.height)
//-->
</ Script>
|
Thus, it is possible to pass the parameter to a PHP script via a redirect in Javascript.
Quote:
<?
if (isset ($ _GET ['r']))
{
echo "<script language=\"JavaScript\">
<! -
document.location = \ "$ PHP_SELF? r = 1 & width = \" + screen.width + \ "& height = \" + screen.height;
//-->
</ Script> ";
}
else {
/ / Code to display upon detection of display resolution
if (isset ($ _GET ['width']) & & isset ($ _GET ['height'])) {
/ / Detected Resolution
}
else {
/ / Resolution not detected
}
}
?>
|