Jump to content

Screen resolution detection and Redirect


websiteguy

Recommended Posts

Hi,

Hopefully someone can see my error right away. I'm new at javascript, but do understand programming. I installed this script immediately after the <head> tag on my index page.

 

<script language="Javascript"><!--

 

if (screen.width <= 1023) {

document.location = "index8.html";

}

 

if (screen.width > 1024) {

document.location = "index.html";

}

 

//--></script>

 

At 800 x 600, it loaded the smaller version as directed. At 1024 x 768 it loaded the larger version as directed. At 1152 and larger, it just repeatedly clicks and goes nowhere in IE7.0. Firefox also seems to be stuck in a loop.

 

I've tried adding an if else statement and a couple of other changes, but no luck. Can anyone help?

Thanks,

Curt

Link to comment
https://forums.phpfreaks.com/topic/56848-screen-resolution-detection-and-redirect/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.