Jump to content

Recommended Posts

I have a message bar that I made, but am not the best with scripting, so not sure how to handle the local storage

Here is what I have so far http://jsfiddle.net/nDtWM/16/

I believe I have it rigged so it is persistent until the user clears the cache, but am not sure. Also, it does not work so I cannot know :P

Any advice is appreciated.

Edited by Jagst3r21
Link to post
Share on other sites

no, local storage is better than cookies in every way. it can store more information than cookies can ever dream to, its far more secure as websites can't access other websites local storage, and consumes far less bandwith/overhead (local storage starts and ends on the client's browser, it never goes to the server. and it is only accessed when needed, cookies are always parsed even if you're not gonna use them).


your jsfiddle didn't include the jQuery library, so its not even getting to anything inside that $(document).ready.


you also forgot to check if local storage is supported on the browser. older browsers do not have this support and will simply error cause it doesn't know what localstorage is. you also need to enforce html5 doctype (which your jsfiddle is doing)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...