try { localStorage.test = 2;// try to use localStorage } catch (e) {//there was an error so... alert('You are in Privacy Mode\nPlease deactivate Privacy Mode and then reload the page.'); }