|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#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") |
|
|
|
|
|
#2 |
|
Staff
Premium Member
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. |
|
|
|
|
|
#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. |
|
|
|
|
|
#4 | |
|
Staff
Premium Member
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
|
Quote:
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. |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|