Jump to content


Photo

Getting the Screen Width


  • This topic is locked This topic is locked
1 reply to this topic

#1 Pedro999

Pedro999

    Newbie

  • New Members
  • Pip
  • 5 posts

Posted 24 July 2013 - 06:38 AM

Done various searches to find out out to get the screen width. Need to do this to set the width and scrollable height of a table. Mostly, people talk about using javascript to set a cookie. Am I on to a loser here? Occurs that the user may not have cookies set. Also, in my implementation of apache/google chrome get an access error when trying to do (code example from the web):

 

<head>
<?
if(isset($_COOKIE['screenresolution'])) {
 //cookie found!
 $screenres = $_COOKIE['screenresolution'];
} else {
 //cookie is not found, so set it with JavaScript
?>
 <script language="javascript">
 <!--
 writeCookie();
 function writeCookie() {
  var enddate = new Date("December 31, 2060");
  document.cookie = "screenresolution="+ screen.width +"x"+ screen.height + ";expires=" + enddate.toGMTString();
  window.location.replace("<?= $_SERVER['PHP_SELF'] .'?'.$_SERVER['QUERY_STRING']  ?>");
 }
 //-->
 </script>
<?
}
?>
</head>
 
 
Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.

Error 403
 


#2 trq

trq

    Advanced Member

  • Administrators
  • 30,730 posts
  • LocationSydney, Australia.

Posted 24 July 2013 - 06:42 AM

Three things.

1) Does the color you have chosen to post your code in really seem helpful? No.
2) The topic of your question is not related to PHP.
3) Your post seems completely unrelated to your subject.

Try again.

http://thorpesystems.com | http://proemframework.org | http://github.com/trq

SmtpCatcher - A very simple mock sendmail useful for testing PHP mail scripts.
OPM - My Linux package manager.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com