我正在尝试从本地主机访问 Google API。Chrome说这是不可能的,因为起源
XMLHttpRequest cannot load https://maps.googleapis.com/maps/api.... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access.
我https-browserify
用来发出ajax请求。
options = {
hostname: "maps.googleapis.com",
port: 443,
path: "/maps/api/....",
method: "get",
headers: {
"Origin": null,
"Referer": null
}
};
result = null;
req = https.request(options, function(res) {
res.on("data", function(chunk) {
return result += chunk;
});
return res.on("end", function() {
debugger;
});
});
req.end();
但这没有帮助。Origin
发出此请求时,Referer
标头仍然存在。我怎样才能删除它们?