【问题标题】:FileReader and JSON objects not defined in ie11ie11 中未定义 FileReader 和 JSON 对象
【发布时间】:2013-12-13 22:19:38
【问题描述】:

每当尝试在页面初始化时使用 FileReader 和 JSON 打开运行 javascript 代码的页面时,ie11 会报告“FileReader is not defined”,然后是“JSON is not defined”。 HTML文件的头部如下:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>LogViewer</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<link rel="stylesheet" href="css/slick.grid.css" type="text/css"/>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js" type="text/javascript"></script>
</head>

在 FF 和 Chrome 中一切正常。有什么想法吗?

【问题讨论】:

  • 看起来您正在以兼容模式访问您的网站。从 IE10 开始支持 FileReader 和 JSON。检查您的 IE 兼容性设置。并遵循 Jan Schejbal 关于元标记的建议。

标签: javascript json filereader internet-explorer-11


【解决方案1】:

添加&lt;meta http-equiv="X-UA-Compatible" content="IE=edge" /&gt;作为标题的第一个标签以确保。 IE 喜欢进入兼容模式,即使在某些情况下存在 HTML5 文档类型(尤其是在计算机位于域中时的 Intranet 文件上)。

您可以使用开发者工具 (F12) 检查您正在运行的模式。

【讨论】:

  • 如果我绝对必须使用 content="IE=9" 有解决方案吗?
猜你喜欢
  • 2012-04-11
  • 2012-03-16
  • 2013-10-02
  • 1970-01-01
  • 2011-09-18
  • 2014-10-24
  • 2012-08-26
  • 2011-07-08
  • 2018-06-07
相关资源
最近更新 更多