I am trying to upload a static map to the site and receive the following message:

Failed to load http://static-maps.yandex.ru/1.x/?size=390,270&l=map&pl=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0&pt=0,0,round: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.mysite.ru' is therefore not allowed access. 

What could be the problem? The documentation says that you can use it without a key for free.

  • Static API itself works without a key and there should be no problems with CORS on its part. You can verify this by collecting an example on jsfiddle or simply by opening the map image by reference in the browser. Please provide the code of the page where the call to the Static API is made. Also, it is necessary to contact the API via https. - Reni
  • @Reni Url: static-maps.yandex.ru/1.x / ... You can test through the sites test-cors.org and resttesttest.com. Both swear at CORS (you can open a browser-based web console) - GLeBaTi
  • The static API requires displaying a map on the page and when placing an API call in the body of the page, everything works. Here is an example: jsfiddle.net/tpkboc5b Add to the question the code of your page where you call the API and get an error describing the problem to be solved. Without this, it is impossible to tell what is wrong. - Reni
  • one
    @Reni I have a Unity application in which you need to display a point on the map by coordinates. I make a url request with coordinates and get a picture that I load into the texture. In the PC application, everything works fine. In WebGL (which loads via XMLHttpRequest) does not want. - GLeBaTi
  • one
    I understand) You can load the image of the card from the API to your server and already through your own proxy (with the necessary CORS headers) send it to the web page. - Reni

1 answer 1

Especially for you today added cors-headers in the static api response, you can use)

  • Thanks, it worked! - GLeBaTi