Bing Maps V8 - Uncaught ReferenceError: amd is not defined - javascript

Yesterday api was working. Today an error occurs:
Uncaught ReferenceError: amd is not defined
Can someone help me please?
<!DOCTYPE html>
<html>
<head>
<title>loadMapAsyncHTML</title>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
</head>
<body>
<div id='printoutPanel'></div>
<div id='myMap' style='width: 100vw; height: 100vh;'></div>
<script type='text/javascript'>
var map;
function loadMapScenario() {
map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
credentials: 'Your Bing Maps Key'
});
}
</script>
<script type='text/javascript' src='http://www.bing.com/api/maps/mapcontrol?branch=release&callback=loadMapScenario' async defer></script>
</body>
UPDATE
This error was fixed by Bing Team.

The team is investigating the root cause as it appears something has changed in the hosting platform which is causing this issue. No code was changed in any of the Bing Maps branches. In the mean time, many have implemented the workaround that David referenced.
Update: A hotfix is being rolled out. You should start seeing Bing MAps V8 loading again as as the hotfix rolls our across our data centers/servers.
If you license Bing Maps (i.e. are a paying customer), make sure you have logged an incident with the Bing Maps Enterprise support team. This will allow them to send you an incident report in the next week or so with details on this incident. If you do not have contact details for the support team, you can find them here: https://www.microsoft.com/maps/support.aspx

https://social.msdn.microsoft.com/Forums/en-US/31063241-34a2-4787-82ba-8e58bf1a2800/uncaught-referenceerror-amd-is-not-defined?forum=bingmaps
found a fix, add:
<script type="text/javascript">
window.amd = function(){};
window.amd.define = function(){};
</script>
<script type='text/javascript' src='//www.bing.com/api/maps/mapcontrol?branch=release'></script>

Related

Why my Complete HTML Example Page Why doesn't work?

I'm starting with the HERE APIs, but in the first example my code is not working. I've reviewed and refacted it, but when I update my browser, nothing appears.
Can you help me please?
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
<script src="http://js.api.here.com/v3/3.0/mapsjs-core.js" type="text/javascript" charset="utf-8"></script>
<script src="http://js.api.here.com/v3/3.0/mapsjs-service.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div style="width: 640px; height: 480px" id="mapContainer">
<script>
// Initialize the platform object:
var platform = new H.service.Platform({
'app_id': '{xxx}',
'app_code': '{xxx}'
// I have a valid ID and a CODE.
});
// Obtain the default map types from the platform object
var maptypes = platform.createDefaultLayers();
// Instantiate (and display) a map object:
var map = new H.Map(
document.getElementById('mapContainer'),
maptypes.normal.map, {
zoom: 10,
center: {
lng: 13.4,
lat: 52.51
}
});
</script>
</div>
</body>
</html>
Please check in your browser developer tools (network and console tab) for any type of errors you get. It will help you understand more about the issue you are facing.
If your issue is similar to something like below then try this solution:
Security Error: If your browser complains about the Javascripts you have included try using there https version like below
<script type="text/javascript" src="https://js.api.here.com/v3/3.0/mapsjs-core.js"></script>
<script type="text/javascript" src="https://js.api.here.com/v3/3.0/mapsjs-service.js"></script>
If you are seeing some other error then paste the error for us to help you better.
Is there any error on the console?. I pasted your code inside of my editor and it work normally. One thing that you might be doing it wrong could be that you are placing the '{yourkey}' with the {} instead of 'yourkey'. You don't need the { }. Other than that, I can't seem to see what the problem would be.

Ignoring particular javascript files

in my website i have embedded accuweather widget:
<div id="awcc1459281264171" class="aw-widget-current" style="float:right; width: 479px; height: 180px; margin:12px;" data-locationkey="275174" data-unit="c" data-language="pl" data-useip="false" data-uid="awcc1459281264171"></div><script type="text/javascript" src="http://oap.accuweather.com/launch.js"></script>
today i realized that i didnt pay last internet provider bill and instead of lanunch.js i got this stuff loaded:
<html>
<head>
<meta http-equiv="refresh" content="2; url=https://ebok.upc.pl/blokada">
<script type="text/javascript">
setTimeout("document.location='https://ebok.upc.pl/blokada';", 1000);
</script>
</head>
<body></body>
</html>
saying internet connection has been blocked. Unfortunatelly this replaced by provider file is generating error on my webpage, and makes it non functional:
Uncaught SyntaxError: Unexpected token < launch.js:1
question is - what would be the best workaround for that? mean how to disable widget if there is no internet connection etc?
thx for all responses

Bing Maps v8 doesn't show

I am trying the new Bing Maps v8.
I follow one of the firsts examples:
http://www.bing.com/api/maps/sdk/mapcontrol/isdk#loadMapSync+HTML
It works. But when I add a text, like test, it stops showing the map:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
</head>
<body>
test
<div id='printoutPanel'></div>
<div id='myMap'></div>
<script type='text/javascript' src='http://www.bing.com/api/maps/mapcontrol'></script>
<script type='text/javascript'>
function loadMapScenario()
{
var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
credentials: 'Your Bing Maps Key'
});
}
window.onload = loadMapScenario;
</script>
</body>
</html>
The word test in the 7th line makes it to stop working.
Any idea?
The doctype shouldn't be the cause for failure here, in fact it should reduce issues as that is the doctype used for HTML5, which the map uses.
The code you provided should work. Looking into this I found that the width of the map is never being set, and as such it ends up being 0. When no width or height is specified for the map, the map tries to use the dimensions of it's parent. It appears that adding the text into body is causing the calculation to be incorrect. I'll have the dev team look into this.
Also, I would only use the Sync method of loading the map if you were migrating old code that needed to run synchronously. If you are creating a new app you should load the map control asynchronously as it will allow your page to load faster. http://www.bing.com/api/maps/sdk/mapcontrol/isdk#loadMapAsync+HTML

Can the v2 and v3 Google Maps API coexist on the same page?

Hey there, I have an issues/bug when trying to have a v3 and v2 google maps on the page at the same time.
The core of our application uses v2 of the API and adding some new functionality we decided to use v3 of the api since v2 is deprecated. So I'm dynamically loading the v3 version of the api in another "tab" on the application.
The problem is if you click on the v3 map and then click on the v2 map the v2 map starts following the mouse cursor around as if you had clicked to start dragging but never released the mouse button. And basically bugs out till you reload the page
Heres an example, with simple instructions on how to replicate
http://jsbin.com/googlemapv3v2/1
The weird thing is if you click/play around with the v2 map first then click/play around with the v3 map it all works nicely.
So I've tried "tricking" it by firing custom click/mousedown events on the v2 map once the v3 api is loaded see http://jsbin.com/googlemapv3v2/2
But no luck there, anyone got any ideas?
EDIT: Should note, it only seems to be happening in chrome, firefox, safari havent tried opera.
I don't think the two APIs are meant to co-exist on the same page. I tried a very basic example, which happens to have the same problem as yours. Tested in Chrome 5.0 and Firefox 3.6.6 (both for Mac):
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Google Maps v2 and v3 on same page</title>
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false"
type="text/javascript"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false"
type="text/javascript"></script>
</head>
<body>
<div id="map_v3" style="width: 500px; height: 400px;"></div>
<div id="map_v2" style="width: 500px; height: 400px; margin-top: 50px;"></div>
<script type="text/javascript">
var map3 = new google.maps.Map(document.getElementById('map_v3'), {
zoom: 6,
center: new google.maps.LatLng(-41.00, 174.00),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var map2 = new GMap2(document.getElementById('map_v2'));
map2.addControl(new GLargeMapControl3D());
map2.setCenter(new GLatLng(-41.00, 174.00), 6);
</script>
</body>
</html>

How to indicate the language in the Google Maps API?

Just like you visit maps.google.com.tw or maps.google.co.kr or maps.google.co.jp, you can see their own language shown on every country. Is there any property that I can use in Google Maps API to dynamically set google maps using specific language to display?
In Google Maps API v3, add "language" attribute to script tag. For example, the following will set map to display Russian in location names and navigation buttons:
<script
src="http://maps.google.com/maps/api/js?sensor=false&language=ru-RU"
type="text/javascript"></script>
Result:
In Google Maps v3, you can use the "language" parameter:
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=en"></script>
Language codes list: https://developers.google.com/maps/faq#languagesupport
More info: http://googlegeodevelopers.blogspot.com/2009/10/maps-api-v3-now-speaks-your-language.html
For the V2 Maps API:
You can add an optional hl parameter to the <script> tag when including the Google Maps API, specifying the domain language to use, as in the following example:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Localization of the Google Maps API</title>
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false&hl=ko"
type="text/javascript"></script>
</head>
<body onunload="GUnload()">
<div id="map_canvas" style="width: 400px; height: 300px"></div>
<script type="text/javascript">
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(36.48, 128.00), 7);
map.setUIToDefault();
</script>
</body>
</html>
Screenshot:
You may also want to check out the following resources for further reading:
Supported list of domain languages
Localization of the Google Maps API
language code is IETF language code:
http://en.wikipedia.org/wiki/IETF_language_tag
<script
src="http://maps.google.com/maps/api/js?sensor=false&language=ru-RU"
type="text/javascript"></script>

Categories