Bing Maps v8.0. Microsoft.Maps.Location is not a constructor in chrome

I am working on updating Bing Maps Version 8.0 from version 6.3. Below is my updated code that is causing the error:

var Points = [new Microsoft.Maps.Location(0, 0), new Microsoft.Maps.Location(0, 0)]

The above lines after executing it give me an error message

"TypeError: Microsoft.Maps.Location is not a constructor"

The above problem occurs in Google Chrome browser. But the same thing works fine in Internet Explorer.

Any suggestion is helpful.

Thanks in advance.

Regards, Rahul

+4
source share
1 answer

, , Microsoft.Maps , script. V8 script , , script, , . , script. , URL- script. :

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8" />
    <script type='text/javascript'>
    var map;

    function GetMap()
    {
        map = new Microsoft.Maps.Map('#myMap', {
            credentials: 'YourBingMapsKey'
        });

        //Add your post map load code here.
    }
    </script>

    <script type='text/javascript' src='https://www.bing.com/api/maps/mapcontrol?callback=GetMap' async defer></script>
</head>
<body>
    <div id="myMap" style=";width:800px;height:600px;"></div>
</body>
</html>

map script . , , script , .

+2

Source: https://habr.com/ru/post/1678160/


All Articles