I have saved long string in localMemory named UserContacts
, but it takes very long to access the data, here is the code that I am using:
var $Contacts = $('#Contacts');
var htmltext = window.localStorage.getItem("UserContacts");
$(htmltext).appendTo($Contacts);
$Contacts.listview("refresh").listview();
Any ideas how to improve performance for this?
PS I am developing application for android and using PhoneGap.
Thank you.
instread of storing html in localstorage you should save only data and then create your html using javascript, see below code
var data = window.localStorage.getItem("UserContacts");
var len = data.length;
var html = "";
for(var i=0; i< len;i++) {
html += $("<li/>").text(data[i]);
}
$("ul#yourId").append(html)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.