Javascript Session Data Storage - javascript

Does anyone know of a reliable way to store data to use across pages of a site?... Here is what I've found so far:
Cookies - Not enough capacity to store what I need atm.
URL hash - Same as above
Frames - Not a method I would use atm.
HTML 5 document.localStorage and document.sessionStorage - Not fully supported yet
Google Gears - The users of the site will most likely not have this installed
YUI Storage - This sounds promising... does anyone have experience using it?
jStore - This also sounds promising, but when I tried using the demo and reloaded the page, it lost my input. Does anyone have experience with this plugin?
Note: I am not an admin of the site in question, so I don't have database privileges, but I am able to add scripting.
Edit: I found this interesting site that saves session variables in the window.name... it probably has some security issues as well

Dojo has a cool plugin that uses flash for a local storage. Plus it abstracts it so if they have gears or an html5 browser it will use that instead

<input type="hidden"
store the value in it, the info comes back from the page together with the info, and after you send it to another page, and so on

Can you use server-sides sessions?

Related

JavaScript Temporary Storage

I am writing a Quiz Application and require JavaScript mechanisms to temporarily store data without utilizing MySQL or an Internet Connection. The Game is a Standalone application. What techniques or libraries may be useful for such an application to store game data temporarily in the particular instance of running the JS functionality.
Please provide any references that may be useful.
Much appreciated
If you don't need your data to stay after you leave the page, consider using sessionStorage.
Otherwise, you're fine with localStorage, like I said in the comment, here is a very related answer: https://stackoverflow.com/a/26026430/965907
You can use cookies, but localStorage is a bit more modern and provides several advantages. See https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage for a list of storage options in modern browsers.
localStorage and sessionStorage are very similar, and I'd suggest you just use localStorage. See HTML5 Local storage vs. Session storage for a broader discussion.
Maybe you can use javascript cookies. With them you can keep information with a name for as long as you would like. sessionStorage and localStorage are harder to understand and add to your page, but if you are an expert then you could use those. But as I said, I would recommend using cookies.Good luck with your work!

Is possible to use the browser storage as a data repository?

With Javascript, exist some way to do a data repository (like the repository pattern for example), using the local storage of the browser? If exist, which compatibility issues between browsers will be found?
I believe this is what you are looking for:
http://coding.smashingmagazine.com/2010/10/11/local-storage-and-how-to-use-it/
It explains how to use the local storage on newer browsers(HTML 5 enabled) without the need for cookies.
I dont think it is possible to save data on browser storage.
other things you can do is using other ways to control that.
1st Way:
data you need to save for the entire session of the user you can globalize in your web by just declaring it as Global variable.
2nd Way
You can use the jQuery plugin called Cookie, you can find it in here
cookie will basically means saving for a longer term then the session. and it is ,in fact, saving data on the user's computer.
My personal suggestion : if you absolutely need to save data and a lot of it in a way, i would either suggest you to save it on your sever (if you have any) or by cookie.
If this answer wasn't enough satisfying for you, please comment and i will try to be more accurate and helpful.

Chrome extension, Store data

I've read this question: Chrome Extensions & Javasctipy Database but I want an answer with more details and more clear.
How can I store some of my extension settings?
Is it possible to use a database to do such things with JavaScript?
Is there any good tutorial on it?
I don't want to use Local Storage, because I do not want the behavior of SESSIONS
Thanks.
You could use chrome.storage.sync or chrome.storage.local (docs). Both are local storage (not session storage); sync has the additional advantage that it syncs to the user's Google account if they've connected Chrome to it.
The following page lists the storage mechanisms in HTML5. WebSQL gives you a pretty good database for your javascript to use.
http://www.html5rocks.com/en/features/storage
UPDATE: It has been some time since I posted this. WebSQL has been dropped. Browsers will probably still continue to support it, but all the implementations have been SQLite. IndexedDB is the way to go now. I have used it and it is a little hard to get into, but works well for a client side database.
UPDATE AGAIN: Chrome changing things. See T.J. Crowder's Answer.
I believe this is a simple solution for you if you just want to save some settings. It also has some examples, hope it helps.
https://developer.chrome.com/extensions/storage.html

Sharing data across multiple windows in javascript (client-side)

So let's say I have a website which doesn't require login but I want to be able to track the user's activity based on what they click on my website, and display data accordingly. For example, if they keep looking at children's books to buy, I would recommend similar children's books. Is this possible in javascript?
The only solution I can come up with is cookies, is there a more efficient way?
Thank you.
I hope this is an acceptable question to post on here, as it is not code related
You could use HTML local or session storage. These are both easier to use than cookies.
You can also use Mod­ern­izr for browsers that do not support HTML5.
html5 websockets might be of help.

Converting Grails web application to offline web application

I've been doing some research on the HTML5 local storage/offline capabilities and I'm beginning to get a better understanding of it. I've been designing a billing application with Grails and I'm just wondering if it is possible to set up a Grails application to be an offline web application, like you can with HTML5 (by utilizing a Manifest file). If so, would it be set up in the same way that you'd set it up with HTML5, or would there be any key differences to make a note of? Also, what is the best way to implement the local storage functionality of HTML5 in Grails? Is there any plugin or framwork available for this purpose . Has anyone ever used this plugin/framework before, and if so, do you know if there are any guides or examples that use it anywhere that would be really able help me get started with it?
I'd appreciate the information on making a Grails app work "offline
Thanks in advance!
I am developing an offline HTML5 app, myself. The biggest difference is that it is a single page rather than many small ones (but it might work that way if you tried it; you would need to be sure it got all the data it needs at startup).
Don't forget to add the application cache mime type to your configuration.
I never thought to look for a plugin for local storage. In my project, the local tables (I'm using WebSQL because it's in Webkit browsers) are different from the domain classes because they have a different function; that is, they have to hold the data for the domain tables untilthe device can sync with the host.
I hope there is something useful here.
Ed

Categories