0

Here is the code

// src: https://lbsyun.baidu.com/jsdemo.htm#aCreateMap
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <style>
      ....
    </style>
    <script src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=API_KEY"></script>
</head>
<body>
    <div id="container"></div>
</body>
</html>
<script>
var map = new BMapGL.Map('container'); 
map.centerAndZoom(new BMapGL.Point(116.404, 39.915), 12); 
map.enableScrollWheelZoom(true); 
</script>

How to resolve 'SCRIPT5009: BMapGL is undefined' error displayed on IE11 while the code works fine on Chrome, Edge, and Firefox?

tek ted
  • 1
  • 1
  • Maybe this is because IE11 is extremely outdated and not used anymore? Only 0.46% of users. Why do you need it to function on this old browser? Just out of curiosity? – Klaassiek Mar 27 '23 at 18:44
  • I noticed that the official website of Baidu Maps (https://map.baidu.com/) is able to run on IE11, but when checking the window(var), it doesn't contain BMapGL, instead it uses BMap. However, the entire map looks like it's using BMapGL (2.5D/3D), and it doesn't seem to be using BMap 3.0 either (https://lbsyun.baidu.com/jsdemo3.0.htm#ridingroute). – tek ted Mar 28 '23 at 00:57

0 Answers0