I am trying to implement a simple web-app using indexedDB, and use this snippet of code to detect browser compatibility:
if(!window.indexedDB) {
alert("Your browser does not support indexedDB.");
}
When run in Chrome it does not open an alert box(as expected), but when run in IE, the alert box pops up. I figured this was just a crappy version of Internet Explorer, so I checked. It was 11. I went to http://caniuse.com to see what version is supported, and IE 11 is supported. What is going wrong? am I using the wrong code to detect indexedDB?
IE11 does indeed support IndexedDB and the code you provided looks reasonable, so if the alert isn't appearing, then there must be some other factor. You didn't mention much in the way of your environment, so here are a few things to look at:
If this a public webpage loaded through HTTP or HTTPS, it's likely you're not loading the page in edge mode, as in you may be using a DOCTYPE that does not render in edge mode (formerly known as standards mode). If you're not sure what this means, please make sure the first line in your webpage is <!doctype HTML>
. (The tip about using F12 tools to verify the document is a good one.)
If this webpage is running on your local network (including your local hard drive), it's possible the page is being loaded in compatibility view. You'd want to add an x-ua-compatible header where "content="ie=edge"
.
One other possibility might be that, due to local group policy settings and/or other environmental factors, IndexedDB might be disabled. That's hard to predict, but one way to respond might be to try to test the feature using code that claims to work in an entirely different environment, e.g. a PC attached to some other environment, e.g. your home network.
Not sure precisely what to suggest at this point, but (hopefully) there's something useful here.
Hope this helps...
-- Lance