|
-
Nov 12th, 2005, 07:45 PM
#1
Thread Starter
PowerPoster
Get the Screen size of a User?
Is it possible to get the screen resolution the user it running? I was hoping to create some page content in PHP and then no where to position it based off how much space will appear (the page is centered so I'll have room on the left and right).
I guess I could get the page size with Javascript and then do a redirect, but thats really crappy, and trying to limit how much Javascript I use.
-
Nov 12th, 2005, 08:11 PM
#2
Re: Get the Screen size of a User?
Like you said, the only way to do this is through Javascript. There is nothing wrong with using Javascript if the browser supports it. The way to do it is to get the page looking as close as possible without Javascript, then, put a small script at the bottom of the page which resizes the content accordingly.
By coding for the lowest common denominator and building the more enhanced functionality such as CSS and Javascript on top you can be sue the the page will always display.
-
Nov 13th, 2005, 12:56 AM
#3
Thread Starter
PowerPoster
Re: Get the Screen size of a User?
I really don't like Javascript though, it can really give bad performance on low end comps.
I swear I thought I saw a way to get the size with the headers? How do all those traffic generators get there hit details, JS as well?
-
Nov 13th, 2005, 01:32 AM
#4
Re: Get the Screen size of a User?
 Originally Posted by Pc_Madness
I really don't like Javascript though, it can really give bad performance on low end comps.
What gives you this idea? - What do you class as low end?
A Few browsers, namely text based, not including IE and Firefox, will pass the screen resolution in the User Agent string, but, rarely, of what use will this be, if you do not know the Window Size.
The best thing to do is, design for your lowest resolution maybe 800x600 and use a small piece of JS at the bottom to resize appropriately, and no, it does not slow it down, the JS interpreter is loaded into memory when the browser starts, so unless your users are using Pentium 2 machines with only 24Mb of RAM, the performance hit is negligible.
-
Nov 13th, 2005, 02:54 AM
#5
Thread Starter
PowerPoster
Re: Get the Screen size of a User?
 Originally Posted by visualAd
What gives you this idea? - What do you class as low end?
A Few browsers, namely text based, not including IE and Firefox, will pass the screen resolution in the User Agent string, but, rarely, of what use will this be, if you do not know the Window Size.
The best thing to do is, design for your lowest resolution maybe 800x600 and use a small piece of JS at the bottom to resize appropriately, and no, it does not slow it down, the JS interpreter is loaded into memory when the browser starts, so unless your users are using Pentium 2 machines with only 24Mb of RAM, the performance hit is negligible.
Well most people have there window at full screen, I dunno I'm not looking for something perfect.. I dunno will take a proper look at it later and see what I can knock up.
My Cel 1.1 with 256mb ram (xp) used to be aware of very Javascript pages, chuggy ness
-
Nov 13th, 2005, 03:32 AM
#6
Re: Get the Screen size of a User?
You'll be surprised how much Javascript is behind the forum's pages . If you have Firefox, disable JS and you'll see how different the page looks.
-
Nov 13th, 2005, 04:50 AM
#7
Hyperactive Member
Re: Get the Screen size of a User?
the only thing i see change is the "VB Wire News" thing at the top.
Without balance, there could only be chaos.
Without chaos, there could be no balance.
I live with karma. Eat with destiny. Dream of life without shackles....
Yet. If life had no consequences, life could not exist, nor could it flourish.
If at first you dont succeed.You're screwed.
C++/Java NOOB.
I aint a professional at PHP, but if i can help i will.
-
Nov 13th, 2005, 06:36 AM
#8
Re: Get the Screen size of a User?
All the thread tools and members options menus will be disabled too.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|