Pedro999 Posted July 24, 2013 Share Posted July 24, 2013 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 Link to comment https://forums.phpfreaks.com/topic/280457-getting-the-screen-width/ Share on other sites More sharing options...
trq Posted July 24, 2013 Share Posted July 24, 2013 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. Link to comment https://forums.phpfreaks.com/topic/280457-getting-the-screen-width/#findComment-1441919 Share on other sites More sharing options...
Recommended Posts