【发布时间】:2020-03-21 23:49:51
【问题描述】:
我需要为不同的IE版本执行这个.php文件,但是当我模拟到时出现以下错误:
- IE 8:“gvjs_VL”未定义。
- IE
当IE版本为
提前谢谢你。 :)
<!DOCTYPE html>
<?php
$chartData = array(array("Area" , "Number of people"),
array("A" , 5000),
array("B" , 8000),
array("C" , 400),
array("D" , 40000),
array("E" , 1000),
array("F" , 1400 ));
?>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
<link rel="stylesheet" href="main.css">
</head>
<body>
<div class="chartContainer">
<div id="piechart" class="piechart">
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
// Load google charts
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
// Draw the chart and set the chart values
function drawChart() {
var data = google.visualization.arrayToDataTable( <?php echo json_encode($chartData, JSON_NUMERIC_CHECK); ?>);
// Optional; add a title and set the width and height of the chart
var options = {fontName:'Arial', legend:{position: 'labeled', maxLines:15, alignment:'start'},
textStyle: {color: 'black', fontSize: 30},
pieHole: 0.4, sliceVisibilityThreshold:0.0,
chartArea: {
width: "100%",
top: "0%",
left: "0%"},
};
// Display the chart inside the div> element with id="piechart"
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}
</script>
</div>
</div>
</body>
【问题讨论】:
-
来自docs:
Why do my charts work in some browsers but not all? [...] With Google Charts, there are sometimes problems in Internet Explorer 8 and earlier。连微软都不支持IE8了。 -
微软这些天甚至懒得支持 IE10。谷歌当然不会。 microsoft.com/en-us/microsoft-365/windows/end-of-ie-support
-
我认为它与旧版本 IE 中不包含的 json 有关。非常感谢您的澄清
标签: php internet-explorer web-applications emulation google-visualization