PDA

Click to See Complete Forum and Search --> : [RESOLVED] Screen Resolution


I_Love_My_Vans
Jul 5th, 2006, 04:11 PM
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

$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>

john tindell
Jul 5th, 2006, 04:18 PM
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.

I_Love_My_Vans
Jul 5th, 2006, 04:32 PM
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)

penagate
Jul 5th, 2006, 07:10 PM
Is this because you can't make your layout work below 800x600?

Kasracer
Jul 5th, 2006, 07:49 PM
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.

visualAd
Jul 6th, 2006, 04:52 AM
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.

I_Love_My_Vans
Jul 6th, 2006, 07:03 AM
My site view perfectly in 800 x 600 :D

Just below that it gets a little :S <--

penagate
Jul 6th, 2006, 07:05 AM
Well, that's your fault and you shouldn't annoy people about it.

I_Love_My_Vans
Jul 6th, 2006, 10:33 AM
Right, point taken :thumb: