Click to See Complete Forum and Search --> : Resolution redirection
chrismitchell
Aug 3rd, 2001, 05:44 AM
I am trying to redirect the user to the right resolution version of my site when s/he clicks on the enter button on the splash page.. I know this can be done but my code doesn't work... can someone help me?
chenko
Aug 3rd, 2001, 05:47 AM
this is from a stats counter, somewhere in there it logs the screen res... this is assuming your talking about using ASP?
also, here are some javascript/html files, this is really old, and I think there might be somit there
http://members.aol.com/vbchenko/codehtml/applets.htm
chrismitchell
Aug 3rd, 2001, 05:56 AM
I am sure that I managed to do it in JavaScript... I am sure of it... but I think that ASP will do it too.. I looked through your list there is nothing ther mate.. sorry.. :( Thanks for your help anyway...
chenko
Aug 3rd, 2001, 06:18 AM
DAMN!! how the heck does it log the res then?? ummmm
chrismitchell
Aug 3rd, 2001, 06:29 AM
Found out how... I knew I had it somewhere!!!! :) It sends a request to the computer to find the screen res.. it then redirects you to the correct site!
Its done like this:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function redirectPage() {
var url800x600 = "http://www.yoursite.com/800x600";
var url1024x768 = "http://www.yoursite.com/1024x768";
if ((screen.width == 640) && (screen.height == 480))
window.location.href= url640x480;
else if ((screen.width == 800) && (screen.height == 600))
window.location.href= url800x600;
else if ((screen.width == 1024) && (screen.height == 768))
window.location.href= url1024x768;
else window.location.href= url640x480;
}
// End -->
</script>
With the relevant loations of course.. Then in the button for the actual link add :
onClick="redirectPage()"
I thought that it was something like that!!!!! :D
chenko
Aug 3rd, 2001, 06:31 AM
if its any help here is the config.asp page that was included into that file i sent you.
chenko
Aug 3rd, 2001, 06:32 AM
Ok, I just decided to send you the whole stats program... I know it logs the res...but i dont know where
chenko
Aug 3rd, 2001, 06:34 AM
Originally posted by chrismitchell
Found out how... I knew I had it somewhere!!!! :) It sends a request to the computer to find the screen res.. it then redirects you to the correct site!
Its done like this:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function redirectPage() {
var url800x600 = "http://www.yoursite.com/800x600";
var url1024x768 = "http://www.yoursite.com/1024x768";
if ((screen.width == 640) && (screen.height == 480))
window.location.href= url640x480;
else if ((screen.width == 800) && (screen.height == 600))
window.location.href= url800x600;
else if ((screen.width == 1024) && (screen.height == 768))
window.location.href= url1024x768;
else window.location.href= url640x480;
}
// End -->
</script>
With the relevant loations of course.. Then in the button for the actual link add :
onClick="redirectPage()"
I thought that it was something like that!!!!! :D
nice!! I think i will save that :D
chrismitchell
Aug 3rd, 2001, 07:35 AM
I thought that I almost had it then I looked on a mates site that I knew used it and stopped it at the right time!!! :) Bloody useful :) I will have to send him an email to thank him! lol! :)
chenko
Aug 3rd, 2001, 07:53 AM
...and he dont get a extra post either ;)
chrismitchell
Aug 3rd, 2001, 08:09 AM
fair enough... well I'm sure that the code above will help people.. :)
chenko
Aug 3rd, 2001, 08:32 AM
yea, Im too lazy to do my site, let alone ones for different resolutions
BTW what was the name of that book you suggested a while back?
chrismitchell
Aug 7th, 2001, 12:01 AM
Which book? For JavaScript: I recommend you get the O'Reilly book because it is a really good reference book, but to start with get the Visual Quickstart book for JavaScript as it is a good way to start in JavaScript. :)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.