I have a requirement where when the user is working on a screen, before the session logs off it saves a message in local storage:

var userid = self.document.Form1.gsAftlnr.value;
/* saves the userid in the above variable */
localStorage.setItem(userid, 'Your previous work was saved in Drafts in the Post Centre.');

Suppose if the userid = 749461, with this above storage, I am expecting the localstorage the store the string data under key name 749461. Correct me if I am wrong.

When the user logs in again, I am executing the following code:
if(localStorage.getItem(userid) !== null)
{ alert(localStorage.getItem(userid)); }
I want this alert to show up only when the same user logs in again, which is 749461 in this case. But this alert is popping up for other users also.

Please let me know what I am doing wrong here.