How to check if the browser supports Html5 localStorage

To check if the browser supports Html5 localStorage you can use the following code snippet.

Sample Javascript

function IsSupportingHtml5Storage() {
    try {
        return 'localStorage' in window && window['localStorage'] !== null;
    } catch (ex) {
        return false;
    }
}

for more informations see W3Schools: HTML5 Web Storage

One thought on “How to check if the browser supports Html5 localStorage

Leave a Reply