Cookie Redirect | JavaScriptSource

Cookie Redirect

Ronnie Moore May 11, 2000

General

Redirects the visitor to different pages based on the value of a stored cookie. If no cookie is found, the available items are displayed for the user to pick from, which sets a cookie for their next visit.


Please choose your Favorite Pet:
Cat
Dog
Gerbil
Gopher

(Choose an animal then reload the page to see how the redirect works.)

Notes

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: cookieRedirect.js


Head

Paste this code into the HEAD section of your HTML document.


Body

Paste this code into the BODY section of your HTML document


Leave a Response

(6 comments)

You would use what is listed in the switch statement.

Lee Oct 31, 2008

How can I make sure to have the same functions removing the check box??

Ricardo Oct 29, 2008

You'll need to post your question [a href="http://www.webdeveloper.com/forum/forumdisplay.php?f=3"]over on the forums[/a].

Lee Jun 26, 2008

Hi.[br /][br /]I am using this script to let visitors set their location on a map and it will then redirect them to the page for their region everytime they visit.[br /][br /]But, is there a way i can make it so they can delete the cookie?[br /][br /]Thanks!

Jon Feb 18, 2008

Due to the limitations of these comments, you will need to submit your question to the [a href="http://www.webdeveloper.com/forum/forumdisplay.php?f=3"]JavaScript Forum[/a] for further help.

Lee Underwood Jan 29, 2008