Cookie Redirect | JavaScriptSource

Cookie Redirect

Ronnie Moore May 11, 2000


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:

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


Source Code

Paste this source code into the designated areas.

External file

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


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


Paste this code into the BODY section of your HTML document

Leave a Response


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=""]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=""]JavaScript Forum[/a] for further help.

Lee Underwood Jan 29, 2008