未在ie11中定义的FileReader和JSON对象
问题描述:
每次尝试在页面初始化时使用FileReader和JSON打开一个运行javascript代码的页面,即ie11报告“FileReader未定义”以及稍后的“JSON未定义”。 HTML文件的头像如下:未在ie11中定义的FileReader和JSON对象
<!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和铬。有任何想法吗?
答
将<meta http-equiv="X-UA-Compatible" content="IE=edge" />
添加为标头的第一个标签。即使在某些情况下存在HTML5文档类型(尤其是在计算机处于域中时的Intranet文件)时,IE也喜欢进入兼容模式。
可以使用开发工具(F12)检查正在运行什么模式。
+0
如果我绝对要使用content =“IE = 9”,是否有解决方案? – tremor
看起来你正在访问在兼容模式下您的网站。从IE10开始支持FileReader和JSON。检查您的IE兼容性设置。并遵循Jan Schejbal对meta标签的建议。 –