当前位置:网站首页>Baidu map JS development, open a blank, bmapgl is not defined, err_ FILE_ NOT_ FOUND

Baidu map JS development, open a blank, bmapgl is not defined, err_ FILE_ NOT_ FOUND

2022-07-07 03:33:00 Senior brother Xiaokang

One 、 Find the problem

On Baidu map open platform — Instance Center , The operation is all right .

  • Copy , Replace ak
  • Keep locally html file
  • open html, The interface is blank
  • F12 Open the developer console , Error reporting found
  • GET file://api.map.baidu.com/api?type=webgl&v=1.0&ak=**************** net::ERR_FILE_NOT_FOUND
  • Uncaught ReferenceError: BMapGL is not defined

 Insert picture description here

 Insert picture description here

Two 、 solve the problem

It's obvious , Script script Can't access , Led to BMapGL Undefined .

I'll take a look at this script carefully src, It's strange at first sight .

    <script src="//api.map.baidu.com/api?type=webgl&v=1.0&ak= Your key "></script>

I'll try // I added https:, And then it's all right ...
 Insert picture description here

The solution is in script Medium src Add... At the front https:

    <script src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak= Your key "></script>

Feel good , Just one button three times ( give the thumbs-up + Focus on + Collection )~

原网站

版权声明
本文为[Senior brother Xiaokang]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130843338784.html