There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot browser bsod computer cpu crash css dell desktop driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware missing monitor network networking outlook outlook 2003 outlook 2007 outlook express password popups problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Identify user's screen resolution???


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
DrP's Avatar
DrP DrP is offline
Senior Member with 481 posts.
 
Join Date: Jul 2005
Location: UK
Experience: What's a compoota?
19-Apr-2006, 09:35 AM #1
Identify user's screen resolution???
Can I identify a users screen resolution using PHP?
I'm thinking of using a different stylesheet depending upon the screen resolution.
I'd also be interested in any comments people have on doing this and whether it is a waste of time or not.
Any help will be mucho appreciated,
__________________
Clive
Rockn's Avatar
Computer Specs
Distinguished Member with 17,888 posts.
 
Join Date: Jul 2001
Location: Mexico of the North, MN
Experience: Disenfranchised American Male
19-Apr-2006, 01:38 PM #2
PHP is a server side language. You would need something client side like Java to determine the screen resolution.
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
19-Apr-2006, 01:46 PM #3
You can get it in JavaScript (for most users) and pass it to your PHP script.
DrP's Avatar
DrP DrP is offline
Senior Member with 481 posts.
 
Join Date: Jul 2005
Location: UK
Experience: What's a compoota?
19-Apr-2006, 03:08 PM #4
Does that mean it isn't sent to the server like, for example, the IP address is?
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
19-Apr-2006, 03:09 PM #5
Right
DrP's Avatar
DrP DrP is offline
Senior Member with 481 posts.
 
Join Date: Jul 2005
Location: UK
Experience: What's a compoota?
19-Apr-2006, 03:26 PM #6
Ok. Thanks, I've found a script I can use:
http://javascript.internet.com/user-...esolution.html
and
http://www.htmlgoodies.com/beyond/ja...le.php/3471261
though I am not sue whether it is worth bothering as some people don't always maximise their browser anyway.
__________________
Clive
thecoalman's Avatar
Computer Specs
Distinguished Member with 2,503 posts.
 
Join Date: Mar 2006
Location: Pennsylvania
Experience: What's the shiny red button for? <click>
19-Apr-2006, 03:32 PM #7
Quote:
Originally Posted by DrP
though I am not sue whether it is worth bothering as some people don't always maximise their browser anyway.
That's why I build all my sites fluid. It's maxed no matter what resolution they are using.
treydx's Avatar
Senior Member with 112 posts.
 
Join Date: Jan 2006
Experience: Intermediate
19-Apr-2006, 04:15 PM #8
Instead of googling for "screen resolution" try searching for "viewport width". You really shouldn't care what their resolution is.

I think (off the top of my head) it's something like
document.documentElement.clientWidth
document.body.clientWidth
and I think there are a few others like innerWidth, it's pretty inconsistent between browsers.

Check www.themaninblue.com, one of his experiments has to do with creating a certain number of columns based on the viewport width. It's very, very informative (and cool).
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:58 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.