为什么Internet Explorer 11无法检测到indexedDB [英] Why does Internet Explorer 11 not detect indexedDB

查看:258
本文介绍了为什么Internet Explorer 11无法检测到indexedDB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用indexedDB实现一个简单的Web应用程序,并使用此代码段来检测浏览器的兼容性:

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.");
}

在Chrome中运行时,它不会打开警报框(按预期方式),但是在IE中运行时,会弹出警报框.我认为这只是Internet Explorer的简陋版本,所以我检查了一下.那时是11岁.我去了 http://caniuse.com 来查看支持什么版本以及IE 11.怎么了?我使用错误的代码来检测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确实支持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:

  • 如果这是通过这是什么意思,请确保网页的第一行是<!doctype HTML>. (有关使用F12工具验证文档的提示为

  • 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".

另一种可能是,由于本地组策略设置和/或其他环境因素,可能禁用了IndexedDB.很难预测,但是一种响应的方法可能是尝试使用声称在完全不同的环境中工作,例如连接到其他环境的PC您的家庭网络.

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...

-兰斯

这篇关于为什么Internet Explorer 11无法检测到indexedDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆