Detect if ie10+ and edge is using inPrivate mode 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 &amp;&amp; (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).
Instead of blacklisting why not whitelist? If you are really just trying to post a message to the user saying your browser doesn't support something, why not just check if indexedDB is available and then if it isn't post something like:

"IndexedDB is only supported in Chrome 24.0, Firefox 16.0, IE 10/Edge, Opera 15 and Safari 7.1 or higher. It may also not work in certain 'Private' mode browsers. Please upgrade your browser to use the full power of our website."

This way you are avoiding lots of attempts of browser detection (which will more than likely break after browsers implement cross compatibility) and provides action for your user on what they can do next (try a different browser, upgrade, not be in private mode, etc).