I am doing an application and I believe html5 web storage, particularly localstorage, will be of great help to me. And surprisingly it is not that easy as I thought. Maybe I don't really understand the whole concept as I am not skilled in JavaScript for that matter.
Now below is the code I am using to call the JavaScript function in an external .js file.
ScriptManager.RegisterStartupScript(this, this.GetType(), "StoreUserLogin", "StoreUserLogin('" + this.LoginHiddenField.Value + "');", true);
Below the above code is the JavaScript function:
function StoreUserLogin(emailAddress) {
if (typeof (Storage) !== "undefined") {
//var emailAddress = document.getElementById('LoginHiddenField');
window.sessionStorage.emailname = emailAddress;
alert("Information from sessionStorage:- " + window.sessionStorage.emailname);
}
else
alert("Browser does not support storage");
}