does anyone know how i can use some javascript to detect the user's screen resolution?
Thanks
:D
Printable View
does anyone know how i can use some javascript to detect the user's screen resolution?
Thanks
:D
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.. :)
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.
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. :)