|
-
Jul 5th, 2006, 04:11 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] Screen Resolution
Right to settle this, i have searched etc
I understand the only way to get a users screen res is through javascript, but im not sure how to take those two values and put them into variables?
I have tried the following....
PHP Code:
<?php
$me=?><input type="text" size="20" name="t1" value="not supported"><?php ;
echo $me;
?>
<script>
<!--
function show(){
if (!document.all&&!document.layers)
return
document.t.t1.value=screen.width
document.t.t2.value=screen.height
document.t.t3.value=screen.colorDepth
document.t.t4.value=screen.pixelDepth
}
show()
//-->
</script>
-
Jul 5th, 2006, 04:18 PM
#2
<?="Moderator"?>
Re: Screen Resolution
You need to sumit the value using a form, for using a HTTP request with AJAX.
PHP is a server side language and is executed before the page gets the browser, Javascript is a client side language and has no knowledge of any processing that happens on the server.
-
Jul 5th, 2006, 04:32 PM
#3
Thread Starter
Frenzied Member
Re: Screen Resolution
 Originally Posted by john tindell
You need to sumit the value using a form, for using a HTTP request with AJAX.
PHP is a server side language and is executed before the page gets the browser, Javascript is a client side language and has no knowledge of any processing that happens on the server.
Ah i see, what i want to do is display a warning message for users with screen reolutions lower than 800 by 600.
Any ideas (Y)
-
Jul 5th, 2006, 07:10 PM
#4
Re: Screen Resolution
Is this because you can't make your layout work below 800x600?
-
Jul 5th, 2006, 07:49 PM
#5
Re: Screen Resolution
 Originally Posted by I_Love_My_Vans
Ah i see, what i want to do is display a warning message for users with screen reolutions lower than 800 by 600.
Any ideas (Y)
This is very easy to do. Just check the document.body.clientWidth and document.body.clientHeight values. If they're lower than 800 and 600, use an alert().
If you do do this, please post the website's URL so I can block it on my router. I cannot stand websites that pop-up useless boxes and though my experience at being a user interface developer, I find users try to get out of the website when a pop-up like an alert() pops up.
-
Jul 6th, 2006, 04:52 AM
#6
Re: Screen Resolution
Don't display a warning. Make the site so it looks good on a 600x800 resolution; then when the page loads, if the resolution is higher; resize the elements so they fit the higher resolution. If it is lower they will just have to scroll. Computers are awkward to use in general if you are silly enough to use a lower resolution, I am sure the they don't need to be reminded.
-
Jul 6th, 2006, 07:03 AM
#7
Thread Starter
Frenzied Member
Re: Screen Resolution
My site view perfectly in 800 x 600 
Just below that it gets a little :S <--
-
Jul 6th, 2006, 07:05 AM
#8
Re: Screen Resolution
Well, that's your fault and you shouldn't annoy people about it.
-
Jul 6th, 2006, 10:33 AM
#9
Thread Starter
Frenzied Member
Re: Screen Resolution
Right, point taken
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
|