haxe.Http request and CORS?

I’d like to query vk.com API (popular russian social network site) from Haxe code.
So I made this code:


class Main {
    public static function main() {
        var http = new haxe.Http("https://api.vk.com/method/users.get?user_id=1");

        http.onData = function (data) {


And I’m compiling it to javascript and including to html page like so:

<!DOCTYPE html>
<html lang=“ru”>
<meta charset=“UTF-8”>
<meta name=“viewport” content=“width=device-width, initial-scale=1.0”>
<meta http-equiv=“X-UA-Compatible” content=“ie=edge”>
<script src=“main.js”></script>

It compiles fine, however when I open the html file with firefox I get an error that the request was blocked as there is no CORS header (I’m having an error message in russian and I don’t know how to translate this message to english properly, sorry). When I tried to google it I only find the answers that suggest adding some headers to the server code, but I don’t have access to server code, it’s a public api. Does anyone know how I can fix this issue atleast for testing purposes?

I tried hosting the files using “python -m SimpleHTTPServer”, however the issue still remains. However it may be that I’m trying to make request from HTTP “site” to HTTPS site.

It seems that vk.com doesn’t allow for CORS requests, but according to ru.stackoverflow the API seems to be supporting JSONP, so you should use that.

Since per the API effectively allows cross domain requests anyway (per JSONP), I think you should reach out to them about adding proper CORS support.