this is the only question Im needing an answer as of now. That might change after i play with the local storage thing...?? Thanks..
this is the only question Im needing an answer as of now. That might change after i play with the local storage thing...?? Thanks..
Hi, is this code supposed to store all of the pics the user just taken with the above technique?:
try {
localStorage.setItem("picData", "data from service");
} catch ( e ) {
if (e == QUOTA_EXCEEDED_ERR) {
// do something nice to notify your users
}
}
what is "picData and "data from service" supposed to mean?
... "picData" ...
I'm also looking for the JS code that would store all the pics just taken that is in a Panel... Thanks??
more specifically, to store the pics in a localStorage Item(s), thanks??
Hello!
1) To make photo slider you would need to use jquery plugin https://www.google.com.ua/search?q=jq....
2) To save images to localStorage on service success run the following code:
codevar picData;
try {
picData = JSON.parse(localStorage.getItem("picData"));
if ({}.toString.call(picData) !== "[object Array]") {
picData = [];
}
} catch ( e ) {
picData = [];
}
try {
picData.push(data.imageDataBase64);
localStorage.setItem("picData", JSON.stringify(picData));
} catch ( e ) {
if (e == QUOTA_EXCEEDED_ERR) {
// do something nice to notify your users
}
}/code
all images will be saved in localStorage as json array in picData variable:
To get them from localStorage to JS variable:
codevar picData;
try {
picData = JSON.parse(localStorage.getItem("picData"));
if ({}.toString.call(picData) !== "[object Array]") {
picData = [];
}
} catch ( e ) {
picData = [];
}/code
is it possible to see whats in the local storage like you can if it would be a text? I tried this code and doesnt work:
alert(localStorage.getItem('picData'));
also, is 'picData' in your above code referring to the local storage variable name i would use?
Hi John,
[quote:]is it possible to see whats in the local storage like you can if it would be a text?[/quote]Yes, in browser developer tools (where exactly - depends on browser). But this is a long string consists of letters and numbers, nothing readable.
[quote:] is 'picData' in your above code referring to the local storage variable name i would use?[/quote]Yes, this is the same variable inside of your app.