views:

420

answers:

1

Is it possible to create a cookie after a user has deleted his/her browser cache (+cookies) entirely?

E.g. Predefined variables loaded into memory

var userID = 1337;
var IP = 222.222.222.222;
var trackingUID = 'LaughingAtDancingFooBars';

If the above method of storing the data doesnt work, perhaps storing the data inside the document. inside a form input element - which is then read?

<input type="hidden" value="1337" id="userID "/>
<input type="hidden" value="222.222.222.222" id="IP"/>
<input type="hidden" value="LaughingAtDancingFooBars" id="trackingUID"/>

<body onunload="makeCookies(userID, IP, TrackingUID)">

makeCookies(){
document.cookie=tracking = userID, ip etc...
}

Just a quick observation really.. When the user has moved off the page, Javascript can still read what is in memory, if not, read what is in the document. With this we can write the cookie again? - Even if the user has cleared the browser cache.

The real question is, wouldn't this become an privacy concern of some sort? - if it works.

+1  A: 

Here is my understanding of your question: If a user is on your page and decided to delete all their cache including their cookies, can you recreate the cookie when the leave the page (i.e. onunload)? And if so, what are the security concerns?

If I am understanding your question right, then the answer is yes you can. However, a security concerned user can always go to about:blank as the only tab in their browser, and then delete their cache, thus ensuring that your cookies are deleted and will not be recreated.

Will most users do this? Probably not. But hopefully this will help answer your question.

Mike
Also, some users set their browsers to delete all cookie when they close the browser. That most like take place after window.onunload().
jmucchiello