I'm trying to use sessionStorage
to display a modal alert only once per session - and I'm trying to do this in IE versions < 9.
The alert will tell users how terrible their IE version < 9 is, and to please upgrade.
Using sessionStorage
works fine in IE 11. But in older versions of IE, I can't get it to take effect (sessionStorage
comes back as 'undefined or null'). I've tested this locally and on a live site. Does sessionStorage
even work in IE < 9, and if not, what's a good alternative I can use in these older IE versions to only display this alert once per 'session'?
My code looks like:
if (sessionStorage.getItem('browserCheck') !== 'true') {
// define alert function
// call alert function
sessionStorage.setItem('browserCheck','true');
}