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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.