Javascript Cookies

Using this javascript cookie tutorial

http://www.quirksmode.org/js/cookies.html

to add some security around a section of my companies website. To be honest the security is not to be too rigid. It’s basically just to double check that people can’t enter this section without agreeing to our terms and agreements. So what I did was put this piece of code

var x = getCookie("BetterWayTest");
if (x)
{	}
else
{	redirection();	}

into a file. What it does is check for the cookie called BetterWayTest which won’t exist when the person first enters the page. They’re then redirected using a function in this file

http://www.abetterway.co.uk/js_nav/secure.js

They’re directed to a page where they have to click accept which then creates the cookie and then lets the person browse that section of the site. And it works. No problems, everythings fine and we’re all happy.

But now I’m trying to reproduce the same files on our dev server for another site and when the first function redirects them the cookie thats been created is gone…

this line in the redirection function is called

createCookie(“OnTheWayTo”,document.URL,0);

and the cookies there, but then when this line is called

self.location.href = “http://www.abetterway.co.uk/adviser/adviser_disclaimer.html”;

it’s gone…
weird thing is though if I create a page on the same directory as the disclaimer page it works. If I put it in a directory it doesn’t.

ANY tips is appreciated with this weird one, thanks :slight_smile: