resolution redirect script
I have a customer that wants a site designed for 1024 by 768 and also for 800 by 600. Due to graphics on the site, have to do two sites changing the graphics for the lower resolution, so it looks good. So, am using the following script on opening page:
<script language="JavaScript1.2">
http://members.tripod.com/technological_tinker/)
Submitted to Dynamicdrive.com to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/
if (screen.width==800||screen.height==600) //if 800x600
window.location.replace("http://www.voiceone.net/800")
else if (screen.width==640||screen.height==480) //if 640x480
window.location.replace("http://www.voiceone/net/800")
else if (screen.width==1024||screen.height==768) //if 1024x768
window.location.replace("http://www.utilibizsolutions.com")
else //if all else
window.location.replace("http://freewarejava.com")
//-->
</script>
Disregard the urls.. the first one is not loaded yet, but, on the opening page, I have a flash movie, short but nice, and have this script on that page to redirect the user to right format of site. My problem is, the user gets redirected before the flash movie begins. How do I (if possible) delay the redirect, till after the movie?.. I have the script after the movie in the html doc, but it still redirects before the flash.. Can this be done?... am using coffeecup firestarter if that helps any.. thanx in advance...
Abhishek Reddy posted this at 04:32 — 24th May 2003.
He has: 3,348 posts
Joined: Jul 2001
Put it all in a function, like so:
<script language="JavaScript1.2">
<!--
/*
Screen Size Redirect script (By Robert @ <a href="http://members.tripod.com/technological_tinker/" class="bb-url">http://members.tripod.com/technological_tinker/</a>)
Submitted to Dynamicdrive.com to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit <a href="http://dynamicdrive.com" class="bb-url">http://dynamicdrive.com</a>
*/
fnRedirect() {
if (screen.width==800||screen.height==600) //if 800x600
window.location.replace("http://www.voiceone.net/800")
else if (screen.width==640||screen.height==480) //if 640x480
window.location.replace("http://www.voiceone/net/800")
else if (screen.width==1024||screen.height==768) //if 1024x768
window.location.replace("http://www.utilibizsolutions.com")
else //if all else
window.location.replace("http://freewarejava.com")
}
//-->
</script>
And call it onload, with a setTimeout in your flash code:
<object onload="setTimeout('fnRedirect()',10000);" . . .
Change the 10000 to whatever length the movie is, in milliseconds.
Should work.
Busy posted this at 05:23 — 24th May 2003.
He has: 6,151 posts
Joined: May 2001
but with if people are using 1024x768 but have it minimised to 800x600 or has tool bars on the side ...
also what if Javascript is disabled (lots of people disable it these days to avoid popups)
can't you have a blank section, or a section of your banner as a percentage to suit any size ?
Suzanne posted this at 14:43 — 24th May 2003.
She has: 5,507 posts
Joined: Feb 2000
I have my screen resolution at 1150 something by whatever, my browser stays at 800x800 because then I can work on a number of things at once. I keep my text app windows open to about 550 each so I can have them side by side.
Ain't user preference a pain!?
The Webmistress posted this at 14:52 — 24th May 2003.
She has: 5,586 posts
Joined: Feb 2001
I'm the same as Suzanne. My screen resolution is 1152*864 but I also have the browser window set to 800*600, so any sites that change to suit my 'true' resolution are a pain in the whatsit for me! Much better to make the site fit 800*600 and either stretch to fit other sizes or look good in the larger resolutions.
See this thread as well which is along the same lines as this discussion.
Julia - if life was meant to be easy Michael Angelo would have painted the floor....
mairving posted this at 15:11 — 24th May 2003.
They have: 2,256 posts
Joined: Feb 2001
Yeah, it is so imperfect to base it on screen resolution for the reasons listed above. Also many people use AOL and have their their IE favorites or Search clicked so as to reduce the resolution because of the left side bar. The main problem with using the redirect is that it lists the desktop resolution and doesn't change based on the browser size.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
dk01 posted this at 15:43 — 24th May 2003.
He has: 516 posts
Joined: Mar 2002
use how about using availWidth and availHeight instead of the the screen height.
-dk
TonyMontana posted this at 18:09 — 24th May 2003.
They have: 218 posts
Joined: Apr 2001
Javascript is still required on many sites, so if you're using it, maybe make your conditionals more flexible, ie:
<script language="JavaScript">
function openNewWindow() {
var sW = screen.width;
var sH = screen.height;
if (sW > 800){
newWindow=window.open("http://www.domain/winLarge.com", "win", "scrollbars=0,resizable=0,x=0,y=0,left=0,top=0,height=sH,width=sW");
}
else {
newWindow=window.open("http://www.domain/winSmall.com", "win", "scrollbars=0,resizable=0,x=0,y=0,left=0,top=0,height=600,width=800");
}
}
///
Substitute 'screen.availWidth' if necessary. Generally it's probably best to have all content 800x600, and then change the border depending on the screen size.
TonyMontana
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.