The privacy settings - you can choose between different levels of cookie handling security. One setting keeps them forever, an other is deleting them every time you navigate away or close the browser etc.
Now this caused the problems using your script too, of course, but, in fact, it has nothing to do with it
