|
-
Sep 21st, 2001, 09:59 AM
#1
Thread Starter
Lively Member
Detecting the screen resolution
does anyone know how i can use some javascript to detect the user's screen resolution?
Thanks
Don't ever Ginop before you Ginip 
-
Sep 21st, 2001, 10:22 AM
#2
Fanatic Member
there is a way... here is how I did it, though I did it to re-direct them to the version of the site that they would be able to see (either 1024x768 or 600x800) though you could use it for more than that amount of resolutions!
Put this bit in the < head >
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function redirectPage() {
var url800x600 = "indexlinks800.htm";
var url1024x768 = "indexlinks1024.htm";
if ((screen.width == 640) && (screen.height == 480))
window.location.href= url640x480;
else if ((screen.width == 800) && (screen.height == 600))
window.location.href= url800x600;
else if ((screen.width == 1024) && (screen.height == 768))
window.location.href= url1024x768;
else window.location.href= url640x480;
}
// End -->
</script>
And put this bit in the button (if you are using a button)
onClick="redirectPage()"
I hope that this helps..
-
Sep 21st, 2001, 10:31 AM
#3
hey chris, I was looking at that code and noticed something that might make it not work.
where is this var - url640x480
just thought you would like to know, or maybeI missed something.
-
Sep 21st, 2001, 04:17 PM
#4
Fanatic Member
I don't have a 640x480 version of the site.. if there is anything there that states 640x480 then it is not meant to be there!
Cheers for having a look Scoutt.
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
|