[英]Access-Control-Allow-Origin in Google Safe Browsing API
I have a script which I give to my clients and they put it in their web pages. 我有一个脚本,我给我的客户,他们把它放在他们的网页。
I want to check inside that script if the domain is safe using Google's Safe Browsing API. 我想使用Google的安全浏览API检查该脚本是否安全。 When the script loads, I make an API request for the current domain with the client key I got from Google.
加载脚本时,我使用从Google获得的客户端密钥为当前域发出API请求。
"Client key" according to Google: 根据谷歌的“客户端密钥”:
API requests are sent directly to Google from your clients' browsers
API请求将从客户的浏览器直接发送给Google
$.ajax({
url: "https://sb-ssl.google.com/safebrowsing/api/lookup?client=demo-app&key=AIzaSyBx5EyJlhg-oB4inoO15fMlP37ljeDP98o&appver=1.5.2&pver=3.1&url=http%3A%2F%2Fstackoverflow.com",
method: "GET",
success: function (result) {
self.onDataReceived(result);
}
});
But the browser blocks my request due to No 'Access-Control-Allow-Origin' header is present on the requested resource.
但是由于
No 'Access-Control-Allow-Origin' header is present on the requested resource.
,浏览器会阻止我的请求No 'Access-Control-Allow-Origin' header is present on the requested resource.
它出现的安全浏览API不支持跨起源请求和你最好的选择是运行在您的域名代理。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.