Checking the client's screen resolution - is that possible?

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
pilau
Forum Regular
Posts: 594
Joined: Sat Jul 09, 2005 10:22 am
Location: Israel

Checking the client's screen resolution - is that possible?

Post by pilau »

I'm working on different design versions of my new website - band website (you can take a look at http://cryhavoc.owns.it) due to several design compatibilty issues, and I was thinking to myself if I could make a page, PHP or some other language, that would check for the user's screen resolution and then redirect to an appropriate page.
Is that possible?
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

Yes it is possible, but its a *really* bad idea.

Almost every assumption you will make about users is going to be wrong. You want to know if they are at 1024, so you can fit x characters of text on the screen. However, in fact, they have a visual shortcoming, so their text is set 4x bigger so they can actually read what you put on the page.

You want to know if you can fit a certain amount of graphics up and down or across the page. However, because the user doesn't know enough to change things, their browser has 5 lines of plugins installed, reducing their screensize below what you expect.

Or they have bookmarks on the left. Or they have..

You get the idea yet? Its an infinite variety of combinations that boil down to one simple statement:

You cannot know what my screen will do.

Based on that, you should follow best practices in web development. Use flexible font sizes. Don't lock the resolution of the display. Use graphics that can stretch without distortion as background. Use percentage sizing rather than pixel sizing.

That way, whether its a power user with a 21" display at 1600, or a granny with a 14" display at 640x480, using superlarge fonts, they can read what you put on the site.

But if you still REALLY want to detect it, you'll need to use javascript, or a php library like http://phpsniff.sourceforge.net
pilau
Forum Regular
Posts: 594
Joined: Sat Jul 09, 2005 10:22 am
Location: Israel

Post by pilau »

Great. Real thanks.
I have neglected the idea, and did what you said - made my site design as changeable as I can without ruining it too much.
Finally, I made 3 versions of the design, one that is made for 800x600 reso, one that is made for 1024x768, and one for 1280x960 and larger resolutions.
Users can choose from those three to make up what suits them best.
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

Damn, mind doing that for my website? :P
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

Roja wrote: That way, whether its a power user with a 21" display at 1600, or a granny with a 14" display at 640x480, using superlarge fonts, they can read what you put on the sitet
21" at 1600 is a power user?? That seems a few years old :)
pilau
Forum Regular
Posts: 594
Joined: Sat Jul 09, 2005 10:22 am
Location: Israel

Post by pilau »

21" is big for a computer monitor.
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

Well that's the smallest of the ACDs...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

yeah.. 21 is pretty small to me.. I feel ultra cramped on this 17W. I find it challenging to functionally work on anything less than 1600.. multi-monitor or not.
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

Yeah I'm on a 30"ACD (2560x1600). And for some of my work I feel like I need a secondary 20" or larger. (Especially when doing videography or photo editting.) Programming is less demanding... multiple terminals, emacs windows and brwosers tile fine.
pilau
Forum Regular
Posts: 594
Joined: Sat Jul 09, 2005 10:22 am
Location: Israel

Post by pilau »

:P
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

...is this not what CSS was made for???
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

Anybody beat two 24" screens side by side? 8)
pilau
Forum Regular
Posts: 594
Joined: Sat Jul 09, 2005 10:22 am
Location: Israel

Post by pilau »

I do! With a baseball bat!
User avatar
shoebappa
Forum Contributor
Posts: 158
Joined: Mon Jul 11, 2005 9:14 pm
Location: Norfolk, VA

Post by shoebappa »

2 19" plus Monitors with Ultramon installed and I couldn't be too much happier. I was drooling over those 30" LCDs for a while but I can't live without being able to hotkey a window to another monitor... 2 30s I could live with : )

Back on topic, there were some good statements above, but I usually dislike variable width websites. I know it sounds all well and good but at 1600+ you end up having text lines that go on for years. I like shorter lines of text for readability and scanability... It's also difficult to make a variable width site look great. Prolly a matter of opinion, but I'd much preffer a fixed width site that would fit on the majority of screen resolutions. I still aim for 800x600 so around 760 pixels wide or so. Some people want things to fit vertically and that's probably a complete waste of time. Scrolling vertically is fine, horizontally should never happen.
pilau
Forum Regular
Posts: 594
Joined: Sat Jul 09, 2005 10:22 am
Location: Israel

Post by pilau »

shoebappa wrote:I still aim for 800x600 so around 760 pixels wide or so. Some people want things to fit vertically and that's probably a complete waste of time. Scrolling vertically is fine, horizontally should never happen.
Well said and well put.
Post Reply