PDA

View Full Version : redirection script based on date


diveman100
12-18-2002, 10:33 PM
Hello,

Does anyone have a script or can help me with a script that will show a particular html page depending on the date and/or a series of dates. The goal is to have an index page that will run a script to detect the current date. If it is a holiday, the script will redirect the visitor to a special index.html page based on that particular holiday (new years, etc.). If the date doesn't reference a known holiday it will redirect to the normal index page. One issue is that certain holidays (i.e. thankgiving) fall on a particular day of the week during a certain week (i.e. fourth thursday of November). I'm trying to make it so that the sites index page will show a special holiday page automatically just for that day and then the following day switch back to the normal index page. I know this is probably really easy for you but I can't seem to figure out how to get it to work. Any help is very much appreciated. Thanks.

ecnarongi
12-19-2002, 06:05 PM
I can say that this technique is not a 100% gurantted. with javascript if you look up the date it will be whatever is on the clients machine which will differ for each and every client. if you use server side script it will depend on the time on the server machine, which could or could not be accurate. Do you get that? I can give you a script for either one, do you still want to use this as a solution?

diveman100
12-23-2002, 03:17 PM
Hi, Thank you so much, your a life saver (not to mention a huge time saver if I can get something that works). If possible can I get the script for the client side? I know it will depend on what the visitors date and time is set at but it's better than what I'm doing now which is manually changing the page depending on the date (not much fun). Thanks again for all you help. I really do appreciate it.

beetle
12-23-2002, 03:40 PM
Everything you need (including calcuating Thanksgiving) can be learned here (http://www.w3schools.com/js/js_datetime.asp)

If you get stuck, let me know.

diveman100
12-27-2002, 03:21 PM
Thanks. This has been very helpful. I appreciate your assistance.