This is an odd case scenario, but I would like to display a message that tells if
indexedDB is not supported or if it is removed due to being in private mode (yes ie10+/edge remove
indexedDB in private mode, crazy uh?).
I think found a way without doing crazy UA sniffing or
documentMode hacks that I think could work.
if(!window.indexedDB && (window.PointerEvent || window.MSPointerEvent)) document.body.innerHTML = "Can't use indexedDB because you are in private mode" else if(!window.indexedDB) document.body.innerHTML = "Can't use indexedDB because you don't have it" else document.body.innerHTML = "woho" // Other browser in private mode can block indexedb // but the message gets handled from db.onerror instead
- IE/Edge is the only browser that removes indexedDB when using inPrivate mode..?
so this is a way to detect private mode, but then you have to figure out if it is ie10+ or edge.
- so ie10 was the latest browser with support for indexedDB
- and ie10+edge is the only browser that support pointerEvent [caniuse]
And I assume there is no other browser with support for
pointerEvent and not having
indexedDB at the same time that could yield wrong message.
What do you think about this? Good, bad? Any suggestions? It would help if you could test if this works in your browser (I don't have Windows).