Skip to content Skip to sidebar Skip to footer

How To Redirect User If They Have A Cookie Javascript

I need to know how to give the user a cookie when they visit the page for the first time in javascript. Then i need the cookie to expire in 1 hour and it to redirect them if the co

Solution 1:

A related solution is described in redirecting to a splash page.


Solution 2:

if it is ok to use Jquery you can use the Jquery plugin

Set a cookie

$.cookie("example", "foo", { path: '/', expires: 7 });

Get a cookie

alert( $.cookie("example") );

Delete the cookie

$.cookie("example", null);

Using this you write your custom logic for redirection in javascript


Post a Comment for "How To Redirect User If They Have A Cookie Javascript"