Click to See Complete Forum and Search --> : How can I...
!¡¤NiCeGuY¤¡!
03-08-2003, 11:02 AM
Ok, at JavascriptSource I found this script, http://javascript.internet.com/user-details/resolution-page.html which allows me to send users to different pages depending on their screen resolution, example: 800x600 and 1024x768. I only have one problem, that script works by users click enter and it takes them to the correct page, but i'd like to know if its possible to send them automatically to the correct page. Im building a splash screen for my site and one is going to be 800x600 and the other 1024x768 but i'd like it so when a user goes to my site, http://www.digitalchronic.com , they will be redirected to the right splash size.
Thanks,
!¡¤NiCeGuY¤¡!
khalidali63
03-08-2003, 11:08 AM
If you look a the code you will se that you have a function call in the buttons on click event.
<input type=button value="Enter!" onClick="redirectPage()">
what you need to do is remove this from that buton or if you do not need that button then remove it altogether.
then add this line in right before you see </script>
tag.
window.onload = redirectPage;
This should take care of your concern..
cheers
Khalid
!¡¤NiCeGuY¤¡!
03-08-2003, 11:21 AM
Thanks
!¡¤NiCeGuY¤¡!
Or, you could simply delete out the function so you are left with this:
<script language="javascript" type="text/javascript">
var url640x480 = "http://www.yoursite.com/640x480";
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;
</script>