Anybody knows ways to store data with javascript clients computer? Except using cookies.
May be there is such lib ?
By the way the data I want to be stored isn't secret if that matters.
You could use HTML 5 Local Storage. It's what the Stack Exchange network uses for global authentication. It's supported only by modern browsers but you could always gracefully fallback to cookies if not supported (IE8+, Chrome, Safari, FireFox 3.6+, and Opera 10.61+ are all supported).
You can use the "normal" js cookie method: http://de.selfhtml.org/javascript/objekte/document.htm#cookie
or if you want to use a lib jquery with cookie plugin: http://www.electrictoolbox.com/jquery-cookies/
If you are talking about database type storage there is google gears and adobe air. These are basically browser plugins that allow you to store data locally on the client. Google have deprecated google gears in favour of the new HTML 5 local storage.
Related
After updated the chrome browser the WebSQL not working from local files, but it is working from server like IIS,Xampp or other. How can I Access the webSQL without using server.
This seems to be a bug.
See Chromium bug report
It is fixed in currently available Beta Chrome version ( 52.0.2743.60 beta-m ).
You can also use Safari browser, which have a pretty safe implementation of WebSql API.
there is no way as latest updates of chrome and opera have put a restriction on code accessing client-side websql database to be accessible from server hosted code only
I am creating a Cross browser Platform Web Application (HTML, JS, CSS), However I require a strong database storage that I can query on the client using JS. Web SQL/SQLite seems to be the best way to go BUT there is no support for it in IE. Does anyone know of any other querable client storage out there. or a working implementation of embedding SQLite "like" functions into the browser.
Thanks
The Web Storage API is available in all major browsers including mobile and desktop. I haven't used it before, but from my research I can tell that it doesn't use SQL queries. It seems to be the best option, even so I would recommend still using a fallback for browser that won't support the API (for example anything before IE8).
Hope this works out for you!
There is usually a limit of 5MB on localStorage on browsers, including iPhone's Safari.
Since PhoneGap has the access higher security privileges including access to other storage mechanisms on the device, in theory they should be able to eliminate the limit of 5MB.
For example, it should be able to get around the usual restrictions by storing the data on a file, etc while keeping the API compatible with localStorage javascript object.
Is this done? Or is PhoneGap limited to the same 5MB?
PhoneGap doesn't do anything out of the ordinary to extend the default limits. On Android, I get 2.5M characters in localStorage (Strings in JavaScript are UTF-16).
You can find default limits for most browsers here: http://dev-test.nemikor.com/web-storage/support-test/
This was helpful in understanding the limitations, and I used the code to create a simplified test PhoneGap app.
PhoneGap has File API that should not be affected by browser local storage limits but don't know if there exist any abstraction to make it behave as HTML5 local storage "backend".
If you want to store a large amount of data you should not do that in localStorage, there are databases and files for that kind of need. localStorage is a key-value datastore, it's use is limited and it should not be "hacked" to fit all needs.
Localstorage is something which is provided by the browser.
Localstorage is not something which is available on a device, either a mobile phone or a desktop, that is leveraged by a browser.
Since it is something which the browser provides there is no way, we can change/increase it using Phonegap since your Phonegap app runs inside the browser.
If you want more storage space, you can use a technique which Phonegap can access like a file storage or SQlLite.
In PHP I can store values in a session I can get until it is destroyed / unset,
Is this possible in jQuery or JS, too?
I need to store client side values to retrieve them in another page.
Use cookies or if you need to store lots of data and don't need compatibility with non-state-of-the-art browsers you could also use HTML5 localStorage.
There is nothing like a session variable directly available in javascript but there are definitely some alternatives to achieve this type of behavior. Two I can think of:
Javascript cookies
As demonstrated on this page you can create and retrieve cookies in javascript.
AJAX
You could use AJAX requests to set and retrieve your session variables from a php file. If you're not familiar with AJAX you can find some decent examples here for the classic javascript approach or in case of jQuery in the jQuery .ajax() docs. This method is probably more reliable because it doesn't depend on the client allowing cookies.
You can use JStorage plugin for this ,JStorage , jStorage makes use of HTML5 local storage where available and userData behavior in Internet Explorer older versions. Webkit SQLite is not supported.Current availability: jStorage supports all major browsers - Internet Explorer 6+, Firefox 2+, Safari 4+, Chrome 4+, Opera 10.50+ , (under 1kB when gzipped)!
I want to store some data client side. Cookies are my first inclination, but they get sent with every request, right? Is there a way to store data without it being transferred? I don't necessarily want to add 10-20k of overhead for every request. Is the only alternative HTML 5 webstorage and how many browsers have adopted that?
html5 storage is widely deployed
HTML5 STORAGE SUPPORT
IE FIREFOX SAFARI CHROME OPERA IPHONE ANDROID
8.0+ 3.5+ 4.0+ 4.0+ 10.5+ 2.0+ 2.0+
you can find out more # http://diveintohtml5.ep.io/storage.html
No, not all cookies get sent with every request. You can check to see if a cookie exists, if not create it, and if so, read it. Cookies are still a good cross-browser option for small amounts of data.
http://fsojs.com supports robust file storage client-side, but only works with Chrome at the moment
As you have mentioned, cookies are an options and so is web storage in the HTML5 spec. There's also the ability to use Flash to store data with the added benefit that this data persists across multiple browsers on the same machine, but the drawback that you'll need a fallback for users who don't have Flash.
Personally, keeping the data on the server (identified by the session id or cookie) would be my way to do it, you have control of the data and don't have to worry about losing it when the user clears their cache or switches machines/devices. It's also the most fault-tolerant because it doesn't rely on browser features and/or plugins (other than perhaps cookies).
One more thing, if you're looking for an abstraction of client-side data storage that uses all of the above (cookies, flash, web storage) check out Evercookie