Forum Moderators: open

Message Too Old, No Replies

Redirect according to resolution.

Problem in Firefox

         

D_Blackwell

2:53 am on Jul 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It works perfectly on my local machine, but when I uploaded and tested; Firefox won't show the 1024 version. It will only show the 800 version. IE works perfectly. What do I need to do to show the correct page on both? Why does it work until I upload it? Where can I find an all-purpose script?

("xx-primary.html" is the 1024 version.)

<script type="text/javascript">
<!--
if ((screen.width>=1024) && (screen.height>=768))
{
window.location="xx-primary.html";
}
else
{
window.location="xx-secondary.html";
}
//-->
</script>

Rambo Tribble

2:14 am on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can I assume the dropped .href in the window.location scope chain was a typo, not in the actual code?

Also, have you checked the actual value returned by the browser for screen.height & screen.width in both circumstances (i.e. alert(screen.width+"x"+screen.height))?

D_Blackwell

4:13 am on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can I assume the dropped .href in the window.location scope chain was a typo, not in the actual code?

The code is exactly as I found it from a script resource.(You get what you pay for:) I have edited to window.location.href="filename";. It still works fine in IE, but not Firefox. I do very little with Javascript. Can you point me to a resource where I can work out the rest of it? (This is how little I use it, but maybe I'll pickup a few things:)

Rambo Tribble

1:35 pm on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The first thing I'd do is run the alert code above from a local load and a server load and see what values are being returned. If both are 1024x768 (and they should be the same, but let's find out), then we'll know more. If the alert doesn't run off a server load it will suggest that FF is trying to run the code too soon in its load process (though the screen should be readable outside the document, there may be some dependency in the implementation).