Cookie Redirect 2 | JavaScriptSource

Cookie Redirect 2

William Bontrager Jan 31, 2007


When a page has performed it's purpose, a cookie can be set to redirect the browser to a different page on subsequent visits. Easily implemented.

(Because it will redirect after one visit, the example is not shown on this site.)


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.

Leave a Response


How would I modify this to put on the index.htm page, so that it redirects to the welcome.htm page if the cookie is NOT found. If it is found, it simply loads the index page. Thanks.

Jesse May 14, 2013

Still testing on our development server but so far this script works great, thanks for your hard work and effort...

Richard W. Zidonis Jan 9, 2008