Local Storage Locstorage
Method:
1.appcan.locstorage.getval (Key) gets the value that the key holds in the Localstorage
// gets the saved color
appcan.locStorage.getVal (' color ');// returns the saved color value
2.appcan.locstorage.setval (Key, Val) to set the key-value pair
// set a color to local storage
Appcan.locStorage.setVal (' Color ', ' red ');
3.appcan.locstorage.val (Key,value) Gets or sets the value of the Localstorage
// get all keys saved in Localstorage
varvalue = Appcan.locStorage.val (' k ');// The return value is an array that contains all the key
4.appcan.locstorage.remove (Key) clear the corresponding value in Localstorage
// Clear saved color values
Appcan.locStorage.remove (' color ');
5.appcan.locstorage.keys () gets all the key values that are saved in the Localstorage
// get all keys saved in Localstorage
Varkeys = Appcan.locStorage.keys ();// The return value is an array that contains all the key
Cases:
Page1_content.html
Add Input box and button
<!--- Insert Search Input box --->
<div class= "sc-bg-active uinput ubub-f1 Bc-border uba "> <div class= "Uinn fafa-search sc-text" ></div> <input placeholder= "Please enter search content" type= "text" class= "Ub-f1" id= " Textid "onblur=" Fun () "> </div> <!--inserting button--> <div class= "Btn ub ub-ac bc-text-headub-pc bc-btn umar-t" id= "BTN" > Press my jump page and get data </div>
Complete event Handling
Button event function appcan.button (". btn", "Ani-act", function () { appcan.window.open ({ name: ' ShowPage ', data: ' Showpage.html ', aniid:10 }); }) //lose focus function onblur= "fun ()" function fun () { //gets the value of the current page div to Textid var city = $ ("#textid"). attr ("value"); //alert (city); //value is stored and set with ID cityid appcan.locstorage.setval (' cityId ', city); }
Showpage_content.html
Add div display <div id= "d1" class= "ULEV1" ></div></body> receive Data Appcan.ready (function () {//var city = App Can.locStorage.val (' Cityid '); var city = appcan.locStorage.getVal ("Cityid"); Alert (decodeURI (city)); $ ("#d1"). HTML (decodeURI (city) + ' Hello! ‘); });
Appcan Local storage for introductory learning Locstorage