Page 1 of 1

getting client's screen resoultion.....

Posted: Tue Jan 20, 2004 9:41 pm
by dull1554
I was wondering if anyone knew of a way to check the screen resoultion on the client side. I'm guessing you can't do this with php (ya know the whole server side limitation thing), i was wondering if you could with js?!?!?!?!

wanted to have several different pages, and load a different one depending on the clients resoultion...

THANKS IN ADVANCE

Posted: Tue Jan 20, 2004 11:41 pm
by Gen-ik
Client-side.

On your index page use JavaScript to grab the screen resolution and then auto-redirect the browser to another page.

Code: Select all

<head>
<script type="text/javascript">
var w = screen.availWidth;
var h = screen.availHeight;

var goto = "anotherPage.php?width="+w+"&height="+h;

if(document.images)
&#123;
    window.location.replace(goto);
&#125;
else
&#123;
    window.location = goto;
&#125;

</script>
</head>

Posted: Tue Jan 20, 2004 11:46 pm
by dull1554
thanks a million.....i hate having those corny....This page designed for 800X600.....and what not......but thanks Master Gen-ik....GOD I LOVE THIS PLACE

Posted: Tue Jan 20, 2004 11:54 pm
by Gen-ik
:) No probs mate.