Web Hosting Talk







View Full Version : Determining Screen Resolution???


matt2kjones
09-09-2002, 01:27 PM
Ok i have created websites which use iframes, and if you create an iframe that fits 800 x 600 screen resolution, it looks small on higher resolutions because you give a particular iframe a size in pixels.

So i was wondering, is there a way, using php, to find out the screen resolution a user is using??

if so i want to do the following.

if the screen resolution is equal, or less that 800 x 600 resolution, then goto http://www.thedigitaldream.co.uk/lowres/ else, goto http://www.thedigitaldream.co.uk/highres/

if you can do this, can someone please give me the code.

Thanx so much in advance.

Matt

Rich2k
09-09-2002, 06:45 PM
Nope you would have to do this in JavaScript.

I've never come across a method of doing this in PHP (that is not to say that it isn't possible though!)

Alturus
09-11-2002, 12:17 AM
It's not possible with PHP. As PHP processes the information before the page gets rendered by the browser (or even sent).

matt2kjones
09-14-2002, 07:12 AM
ok thanx for you info

didn't think it was possible with php as it is server side

not a problem

thanx anyway

Matt

OwenCK
09-14-2002, 08:00 AM
You could always size your iframes with percentages instead of pixels.

Acronym BOY
09-14-2002, 10:52 AM
Or use CSS and have it dynamcially resize, sort of like this:

www.advancedcoolingsolution.net

Acronym BOY
09-14-2002, 11:57 AM
Sorry.

http://www.advancedcoolingsolutions.net/

And the validation:

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.advancedcoolingsolutions.net%2F&charset=%28detect+automatically%29&doctype=Inline

ghost
09-14-2002, 02:22 PM
You can us Java for that;

Insert this in Head tags;

<script>
var winlength = screen.width;

function CheckSize();
{
if ( winlength =< 800 ) { window.location="http://www.thedigitaldream.co.uk/lowres/"; }
else { window.location="http://www.thedigitaldream.co.uk/hires/"; }
}
</script>

and insert it to Body tag like this;

<body bgcolor=#000000 onload="CheckSize();">

I think that can solve the problem.

ghost
09-14-2002, 02:24 PM
Originally posted by ghost
You can us Java for that;

Sorry I mean "use" :rolleyes:

akashik
09-15-2002, 01:51 PM
and mean javascript :D

Greg Moore

mattschinkel
09-15-2002, 09:31 PM
<script language="JavaScript">
var mattwidth = window.screen.width;
var mattheight = window.screen.height
document.write(mattwidth)
document.write("x")
document.write(mattheight)
</script>