문제

I am currently developing a PhoneGap application and am using sessionStorage rather than localStorage because we are facing some problems with localStorage.

Are there any downsides to using sessionStorage over localStorage?

도움이 되었습니까?

해결책

sessionStorage gets erased every time you close the application. Other than that there is no difference.

Here is the usage example:

var keyName = window.sessionStorage.key(0); //Get key name
window.sessionStorage.setItem("key", "value"); //Set item
var value = window.sessionStorage.getItem("key");// Get item
window.sessionStorage.removeItem("key"); //Remove Item 
window.sessionStorage.clear();//Clear storage
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top