[ad_1]
at present making an attempt to implement a kind that saves the information & base64img in localstorage when the consumer is offline and in addition switches the pages.
That is the code that’s in my window.onpageshow = operate(). The humorous factor is, it could learn identify, problemtyp, beschreibung and so forth however not the base64 img. The bizarre factor that this code works completely fantastic on PC… and even weirder is the truth that it could typically learn the bottom and show the picture however it works not on a regular basis…
|| EDIT
I’ve additionally tried to alert base.size and it seems base is null..
Im setting the localStorage with onpagehide with a operate putDataInStorage();
window.onpagehide = operate() {
putDataInStorage();
}
operate putDataInStorage(){
if(userlocation() == "/drawback.html"){
var identify = $('#Title').val();
var problemtyp = $('#ProblemTyp').val();
var beschreibung = $('#beschreibung').val();
localStorage.setItem("identify", identify)
localStorage.setItem("problemtyp", problemtyp)
localStorage.setItem("beschreibung", beschreibung)
}
}
//that is in my window.onpageshow = operate() {
operate putDataInForm(){
if(userlocation() == "/drawback.html"){
var identify = localStorage.getItem("identify");
var problemtyp = localStorage.getItem("problemtyp");
var beschreibung = localStorage.getItem("beschreibung");
var stand = localStorage.getItem("standort");
var base = localStorage.getItem("base64img");
var fname = localStorage.getItem("filename");
attempt {
if(identify != "undefined") { $('#Title').val(identify); }
if(problemtyp != "undefined") { $('#ProblemTyp').val(problemtyp); }
if(beschreibung != "undefined") { $('#beschreibung').val(beschreibung); }
if (stand == 1) {
$('#standort').prop('checked',true);
} else {
$('#standort').prop('checked',false);
}
if(base.size > 100) {
$('#base').val(base);
$('#uploadedimg').attr('src', base);
$('#imgbox').css('visibility','seen');
$('#filename').val(fname);
}
} catch(ex) {
console.log(ex.message);
}
}
}
[ad_2]
