Reputation: 91969
This is a rather broad question and not code-specific. I am looking for opinions that people who know how to implement this requirement
I am building a music application where people can queue music objects. A music object looks like
url: name: views:
A user can queue this song for playing by clicking on the list. At this time I want to build a queue of music objects which then start playing. A very similar example is what grooveshark does:
I pretty much want to implement the same which has following capabilities
I am very new to this so have no idea where to store such data. Please help me understand what is that I need to learn to implement this.
Upvotes: 0
Views: 1038
Reputation: 204
I have used jStorage in the past for this purpose. It;s a nice plugin which provides a wrapper around the local storage where available and userData behavior in Internet Explorer older versions.
Upvotes: 0
Reputation: 1170
As others have answered, localStorage
is probably your best bet.. however you don't have to use it directly if you don't want to. Check out AmplifyJS' amplify.store
, which is a nice wrapper around localStorage
and sessionStorage
that's easy to use and uses feature detection to gracefully degrade on browsers that don't support localStorage (I forget what it uses instead, but it'll store your data. Maybe cookies?)
Anyway, it's worth looking into. http://amplifyjs.com/api/store/
Upvotes: 0
Reputation: 1
Since i could not see a requirement for older browser support i would recomend staying away from localStorage since it has some problem, like it's doing file IO and it's synchronous.
Instead you can have a look at indexedDB which is a bit harder to use, but better in every way as far as i know.
https://developer.mozilla.org/en-US/docs/IndexedDB
Upvotes: 0
Reputation: 7848
If you are OK targeting only HTML5 browsers, you may want to look at something like this: https://developers.google.com/web-toolkit/doc/latest/DevGuideHtml5Storage
Upvotes: 1
Reputation: 30015
localstorage is your best bet
http://www.w3schools.com/html5/html5_webstorage.asp
but you can polyfill and have it work with non-html5 browsers with this:
https://gist.github.com/350433
Upvotes: 2
Reputation: 15291
This is a rather broad question! If you are developing a HTML5 application you may wish to investigate DOM storage facilities such as localStorage
and sessionStorage
(focusing mainly on localStorage
for your needs/system requirements): https://developer.mozilla.org/en-US/docs/DOM/Storage
Here are some useful resources / info:
http://ejohn.org/blog/dom-storage/
http://viralpatel.net/blogs/introduction-html5-domstorage-api-example/
http://msdn.microsoft.com/en-us/library/cc197062(v=vs.85).aspx
Failing that you may want to look into cookies: https://developer.mozilla.org/en-US/docs/DOM/document.cookie However I doubt cookies
will provide you with what you need/want due to limitations in the amount you can store/save
Upvotes: 3