Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 06-04-2004, 10:57 AM   #1
Member (7 bit)
 
Join Date: Jan 2002
Location: Barcelona
Posts: 85
js redirect and old browser problem

I am using this js in my index page to redirect users according to screen res (plus an external file for other stuff) but have noticed that on old browsers (I'm assuming that means without JS but what do I know) this leads to a perpetual state of loading, with the address bar going nuts and the screen flickering away desperately but nothing ever comes.
So, I was wondering if I could do something to stop those old browsers seeing any js at all and just get a page without any js? I've already got it in comment marks which I thought was supposed to do the trick.
Any ideas?
Thanks,
Craig.


if (screen.width==800||screen.height==600)
window.location.replace("http://www.glasgowapartment.co.uk")

else if (screen.width==640||screen.height==480)
window.location.replace("http://www.glasgowapartment.co.uk")

else if (screen.width==1024||screen.height==768)
window.location.replace("http://www.glasgowapartment.co.uk/index1024.htm")

else
window.location.replace("http://www.glasgowapartment.co.uk/index1024.htm")
craigtaylor74 is offline   Reply With Quote
Old 06-04-2004, 12:21 PM   #2
Staff
Premium Member
 
mairving's Avatar
 
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
First I think that it is a waste to try to do what you are doing since you have to build 2 different pages instead of one. As a general rule, just design in the 760px range. Second, why do you care about the height at all. Third, this may not give you the desired results since it only detects the screen size not what they are viewing the page at. For instance, if I have at less than full screen or if I have the search bar clicked on the left, my screen resolution is much less than was detected.

Nevertheless, if you still want to use it, simplify things by just having one conditional for the resolution:
if (screen.width < 1024)
window.location.replace ("http://www.glasgowapartment.co.uk")
else
window.location.replace("http://www.glasgowapartment.co.uk/index1024.htm")

You might even make it simpler by something like:
if (screen.width > 1023)
window.location.replace("http://www.glasgowapartment.co.uk/index1024.htm")

This should just totally void using the window.location.replace since most users with older browsers are most likely using lower resolutions. If that doesn't work then just do a search for browser detection and write some conditionals for it.

Best advice is still to avoid doing this altogether.
mairving is offline   Reply With Quote
Old 06-04-2004, 02:36 PM   #3
Member (7 bit)
 
Join Date: Jan 2002
Location: Barcelona
Posts: 85
thanks for the advice. and do you think it is this muddle that is giving the problems with older pc's? I'm searching for the solution to the the no-show of either site version on those pc's.
also when you say "design for 760px" , won't that leave a very big blank space in the larger resolutions?
Craig.
craigtaylor74 is offline   Reply With Quote
Old 06-04-2004, 03:01 PM   #4
Staff
Premium Member
 
mairving's Avatar
 
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
Quote:
Originally posted by craigtaylor74
thanks for the advice. and do you think it is this muddle that is giving the problems with older pc's? I'm searching for the solution to the the no-show of either site version on those pc's.
also when you say "design for 760px" , won't that leave a very big blank space in the larger resolutions?
Craig.
Most likely it isn't your code that is causing the problem with older browsers. It is the document.write function that is not supported or only partially supported.

You design a site for around 760px since 800x600 is still the largest majority of users. White space is unavoidable. Different people do things in different ways. Here are some examples:
IBM Not all that good IMO
AppleLooks good in any res
AdobeAlso looks good in any res.
mairving is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 06:46 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2