.Maui Blog

Javascript | How to check sessionStorage support

var IS_SESSION_STORAGE_SUPPORTED;

try {

    if (window.sessionStorage) {
        IS_SESSION_STORAGE_SUPPORTED = true;
    }
    else {
        IS_SESSION_STORAGE_SUPPORTED = false;
    }

}
catch (e) {
    IS_SESSION_STORAGE_SUPPORTED = false;
}

if (console)
    console.log(IS_SESSION_STORAGE_SUPPORTED);

Exit mobile version