jStorage
jStorage is a simple key/value database to store data on browser side
jStorage - simple JavaScript plugin to store data locally
I'm using jStorage to store the value of an input, when I click the save button. Then I want to set the stored value as the current input value on page load. It ain't working too well though.
HTML
<input type='text' id='name'>
<div id="save">Save</div>
JS
$('#save').click(function() {
$.jStorage.set("key", $("#name").val());
});
var input_value = $.jStorage.get("key");
Source: (StackOverflow)
I just heard about jStorage and am eager to know more about jStorage(store data locally with JavaScript),its scope and working.Can anyone explain it ?
Source: (StackOverflow)
I am using jStorage to store data locally with JavaScript.
Have not been able to determine how to specify sessionStorage in place of the default localStorage.
Anyone know if it is possible to use sessionStorage with jStorage, and if so, the syntax?
The default localStorage example works fine.
Source: (StackOverflow)
I am trying to store data with a unique ID into the browser's storage, from say a.com
using jStorage and jQuery. I am then trying to read the data using the unique ID from, say b.com
. But jStorage.get('UniqueID')
is not working, and it's not showing the desired output.
Can anyone help me with reading browser storage cross-domain?
Source: (StackOverflow)
I am trying to use jStorage on my site built on jQuery Mobile. It works fine on Chrome, Firefox, Android, some versions of Mobile Safari, and on IE 10 mobile on Windows Phone 8. It gives me an 'undefined' error when I try to set any value.
For example, $.jStorage.set("FBID", response.authResponse.userID);
I have this issue on iPhone 5 (Safari 6.1) and iPhone 4S (Safari 6.0)
Enabling local storage on Safari does not help.
Any ideas or suggestions you could come up with?
Source: (StackOverflow)
I am using the below code to store data using jstorage. i can;t understand what is load_data_from_server(). Please help me to call a code behind function from jstorage
<script src="prototype.js"></script>
<script src="jstorage.js"></script>
<script>
// Check if "key" exists in the storage
var value = $.jStorage.get("key");
if(!value){
// if not - load the data from the server
value = "hai";
value = load_data_from_server() //I want to call c# code behind function here
// and save it
$.jStorage.set("key",value);
}
</script>
Source: (StackOverflow)
I use jStorage to synchronize tabs in IE. When I try to test it with Selenium WebDriver, it does not work.
So, this lines
$.jStorage.subscribe('test', function () {alert('test');});
$.jStorage.publish('test')
does work in manually runned IE and in Selenium's IE in one tab.
And does not work in different tabs in Selenium's IE.
Source: (StackOverflow)
I am developing a cordova application for android.I am persisted some data using jStorage from my javascript.I want to start a service using native code.Is it possible to get the persisted data in my java class. If yes how can I implement that?
Source: (StackOverflow)
I can't get jStorage to work. When I test it with the following code the result is "user is null" How do I get user to return the proper value and also target its attributes that exist in the mySql database.
var user = $.jStorage.get('user');
console.log('user is ' + user);
Source: (StackOverflow)
We are calling jstorage from jquery as in:
$.jstorage.set("foo","bar object");
Later on we look for this key "foo" is gone! Why would this be? We set breakpoints on the jstorage deleteKey method and it is not being called.
Specifically:
$.jstorage.index()
does not contain "foo".
Source: (StackOverflow)
i am using jquery jstorage in my jsp
importing statement
<script type="text/javascript" src='<s:url value="/script/jstorage.min.js"/>'></script>
here is i am setting the value in jstorage
var customerId = $.jStorage.get("customerId", true);//line
i can see below errors in my console
SCRIPT5022: jQuery, MooTools or Prototype needs to be loaded before jStorage!
jstorage.min.js?ver=4.5.8, line 2 character 315
SCRIPT5007: Unable to get value of the property 'get': object is null or undefined
somehow $.jStorage is null in IE at line1 but not firefox/chrome(so works on firefox/chrome).
Source: (StackOverflow)
I have an app I'm developing (still) and asked a question recently about how to Save a Selection List Choice in JavaScript. I have since then been introduced to jStorage, an extension of jQuery which I have been using for my code. I was wondering if I could save the selected value in jStorage much easier instead? The HTML code for my selection list is as follows;
<select name = 'job' id = 'job' style = 'width: auto; background-color: #777; color: white; font-size: 20px; border-color: #AAA;'>
<option value = 'jobselect'>Select Profession</option>
<option value = 'job1'>Mechanical Engineer</option>
<option value = 'job2'>Software Engineer</option>
<option value = 'jobother'>Other</option>
</select>
and I had this in my JavaScript file to save the selected value;
document.addEventListener('DOMContentLoaded', function ListChoice() {
var input1 = document.getElementById('job');
if (localStorage['job']) {
input1.value = localStorage['job'];
}
input1.onchange = function() {
localStorage['job'] = this.value;
}
});
I have two other functions in my JS file called loadSettings and saveSettings, is there a way to change the code above to save the selected value of the list to jStorage in my functions?? Just wondering if it would be easier to save to jStorage. Thanks a lot in advance xx
Source: (StackOverflow)
I am building an app that should be able to work offline.
I am using jQuery Mobile, PHP, MySQL and jStorage in order to easily use HTML5 localStorage
I am trying to figure out the best way to download the data into the local device localStorage and using it at later stages without slowing down or crashing the browser.
I have around 5000 records (500 Kb of data) in a MySQL table, and I need the app to download all this data so that it can be used at a second stage while offline.
download_script.php returns all the records in JSON format
e.g.
{"1":{"1":{"p_bar":"10.30","v_0":"0.0312207306000000","h_vap":"311.78","p_10c":"99.99"}},"2":{"1":{"p_bar":"10.40","v_0":"0.0309405941000000","h_vap":"311.29","p_10c":"0.00"}},
I was wondering if there is any way I could optimize the following script (e.g. in order to not hang the browser, and possibly to display the percentage of data that is being downloaded)
$.ajax({
url: "download_script.php",
cache: false,
success: function(big_json_dump){
$.jStorage.set('some_key', big_json_dump);
}
});
Can this approach be optimized e.g. using radpidjson? How can I change it so to display a live percentage of data downloaded?
Source: (StackOverflow)
I am stuck with a greater JavaScript application (using JQuery Mobile) with big parts of the program logic realized already. Now I want to add serialization to it (using a plugin called JStorage). In this code example, I stringify an object to JSON and then turn it into an object again (all without JStorage), but the methods I added to the original object get lost as in this code:
function TestObject() {
this.lang = "English";
}
// This is the method I want to keep
TestObject.prototype.showLang = function() {
console.log(this.lang)
};
var test1 = new TestObject();
var test2 = $.parseJSON(JSON.stringify(test1)); // after save and reload
test1.showLang(); // this works
test2.showLang(); // this causes an error
The problem has one other constraint: In the code, I often use the point operator to call functions as in test1.showLang(). I know I could add a "global" function like this, it works with the original as well as with the copy:
function showLang(obj) {
console.log(obj.lang);
}
But then I'd have to change each and every existing call to the function from test1.showLang() to showLang(test1) which - in my real project - I would have to do hundreds of times within the entire code. So is there any easier solution how I can use my existing functions on objects after serialization? Thanks in advance.
Source: (StackOverflow)