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);

Leave a Comment

Your email address will not be published. Required fields are marked *