TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Screenresolution (http://www.talkphp.com/general/4967-screenresolution.html)

Tanax 09-24-2009 06:01 PM

Screenresolution
 
Is there any way of getting the screenresolution of the person who views the website?

ioan1k 09-24-2009 09:15 PM

Javascript
Code:

width = screen.width
height = screen.height

If you wanted to track it just send them to a URL with the WxH in some GET parameters and store them :)

adamdecaf 09-24-2009 10:06 PM

Quote:

Originally Posted by ioan1k (Post 28505)
Javascript
Code:

width = screen.width
height = screen.height

If you wanted to track it just send them to a URL with the WxH in some GET parameters and store them :)

Or use ajax to send a HTTP request to a php script that collects the data.

Tanax 09-25-2009 10:18 AM

Thanks guys!
Is there any way of doing this with PHP(in case they have JS disabled)?

Salathe 09-25-2009 10:20 AM

Quote:

Originally Posted by Tanax (Post 28510)
Is there any way of doing this with PHP(in case they have JS disabled)?

Not that I'm aware of, no.

Tanax 09-27-2009 11:09 AM

Damn, well okay. Most people use 960px width, so I guess I use that as a standard. And then run a check with JS to see if they got higher resolution, and then just change it to wider if they got wider. If they don't have JS it will be 960px wide, which is the usual resolution.

Thanks!
Btw, this is something for you PHP guys to develop! Mostly thinking about Karl here who can propose this to the PHP team.

Salathe 09-27-2009 11:27 AM

Quote:

Originally Posted by Tanax (Post 28545)
Btw, this is something for you PHP guys to develop!

If you mean adding this to the PHP core, I can't see that happening. The required information is not sent by browsers to the server, so PHP will never know about it (unless you use JavaScript to send that info. to a receiving script as mentioned above).

Quote:

Originally Posted by Tanax (Post 28545)
Mostly thinking about Karl here who can propose this to the PHP team.

Anyone can make suggestions (and code contributions), you don't need to be "in" with the team to do so.


All times are GMT. The time now is 08:13 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0