XMLHttpRequest CORS errors RRS feed

  • Question

  • Hello,

    before yesterday, everything was fine with bing map.

    But after added the urlembed API to my project and that code below to make it works:

     (function() {
                  var cors_api_host = '';
                  var cors_api_url = 'https://' + cors_api_host + '/';
                  var slice = [].slice;
                  var origin = window.location.protocol + '//' +;
                  var open =;
         = function() {
                      var args =;
                      var targetOrigin = /^https?:\/\/([^\/]+)/i.exec(args[1]);
                      if (targetOrigin && targetOrigin[0].toLowerCase() !== origin &&
                          targetOrigin[1] !== cors_api_host) {
                          args[1] = cors_api_url + args[1];
                      return open.apply(this, args);

    The bing map API works but if I start typing the name of places(bing map AutoSuggest module), I have that error in my console:

    index.php:1 Access to XMLHttpRequest at ',-13.677300453186035,100&count=3&structuredaddress=true&types=place,address&setmkt=en-WW&setlang=fr-FR&histcnt=&favcnt=&clientid=024D522BE7C869DF17285FE5E6C968C4' from origin 'http://localhost' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

    How could i solve that problem to get the AutoSuggest results ?


    Saturday, September 7, 2019 3:26 PM