Working with session storage

As simple as it is to use the local storage, session storage also doesn't add any kind of complexity. For example, let's take a look at how easy it is to port our example of localStorage to sessionStorage:

// check if the sessionStorage is supported by the browser or not
if(sessionStorage) {
// Put some contents inside the local storage
sessionStorage.setItem("username", "joe_henry");
sessionStorage.setItem("uid", "28372");

// Retrieve some contents from the session storage
var user_email = sessionStorage.getItem("user_email");
} else {
alert("The browser does not support session web storage");
}

From this example, it is evident that moving away from local storage to session storage is very easy, with both the storage options providing a similar storage API, the only difference being how long the data in the storage is kept.

With the knowledge of how we can optimize frontends to provide completely scalable and responsive enterprise web applications, now it's time for us to visit some aspects of the enterprise application development that ensure what we are building is secure and works as per expectations, and doesn't delivers random surprises.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.82.217