Checking the client's screen resolution - is that possible?
Moderator: General Moderators
Checking the client's screen resolution - is that possible?
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?
Is that possible?
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
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
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.
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.
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.
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.