Dan_Mason Posted February 25, 2009 Share Posted February 25, 2009 I have got the correct javascript code to get the users current screen resolution, but i am having a few problems putting the numbers into PHP Variables. Here is the code i have so far: <html> <head> <script language="Javascript1.1"> function detect(){ if(screen.width<1280||screen.height<1024){ alert("Your current resolution is "+screen.width+" by "+screen.height+"") } } </script> </head> <body> </body> </html> Any suggestions? Cheers, Dan. Link to comment https://forums.phpfreaks.com/topic/146847-solved-get-screen-resolution-into-a-variable/ Share on other sites More sharing options...
DarkSuperHero Posted February 25, 2009 Share Posted February 25, 2009 You could set the screen resolution into a cookie, and then read it with php... //Javascript document.cookie = "name=value; expires=date; path=path; domain=domain; secure"; <?php $yourCookie = $_COOKIE['name']; Edit: A quick Google search yield this particular search result: http://www.phpbuddy.com/article.php?id=8 Link to comment https://forums.phpfreaks.com/topic/146847-solved-get-screen-resolution-into-a-variable/#findComment-770948 Share on other sites More sharing options...
PFMaBiSmAd Posted February 25, 2009 Share Posted February 25, 2009 Or you could use this method - http://us2.php.net/manual/en/faq.html.php#faq.html.javascript-variable Link to comment https://forums.phpfreaks.com/topic/146847-solved-get-screen-resolution-into-a-variable/#findComment-770953 Share on other sites More sharing options...
Dan_Mason Posted February 25, 2009 Author Share Posted February 25, 2009 Cheers man! All works now Link to comment https://forums.phpfreaks.com/topic/146847-solved-get-screen-resolution-into-a-variable/#findComment-770971 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.