简体   繁体   English

Google安全浏览API中的Access-Control-Allow-Origin

[英]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.

相关问题 XMLHttpRequest Access-Control-Allow-Origin 错误 Google Drive API - XMLHttpRequest Access-Control-Allow-Origin Error Google Drive API Google的Places API和JQuery请求-Access-Control-Allow-Origin不允许来源http:// localhost - Google's Places API and JQuery request - Origin http://localhost is not allowed by Access-Control-Allow-Origin Soundcloud API-来源 <mysite> 是Access-Control-Allow-Origin不允许的 - Soundcloud API - Origin <mysite> is not allowed by Access-Control-Allow-Origin Symfony2:允许使用谷歌图表访问Control-Allow-Origin - Symfony2 : allow Access-Control-Allow-Origin with google charts Api网关不允许访问控制允许来源 - Api Gateway cannot allow Access-Control-Allow-Origin 没有“ Access-Control-Allow-Origin”标头,但无权访问API - No 'Access-Control-Allow-Origin' header but no access to API Angular 2 Access Redmine Rest Api,无“ Access-Control-Allow-Origin” - Angular 2 access redmine Rest Api, no 'Access-Control-Allow-Origin' 尽管使用 dataType:&#39;jsonp&#39;,Access-Control-Allow-Origin 阻止我访问 google api - Access-Control-Allow-Origin prevents me from accessing google api despite using dataType:'jsonp' 请求的资源上不存在“Access-Control-Allow-Origin”标头。 (谷歌联系人api) - No 'Access-Control-Allow-Origin' header is present on the requested resource. (google contacts api) Angular 2:Google Maps API 请求:不存在“Access-Control-Allow-Origin”标头 - Angular 2: Google Maps API Request: No 'Access-Control-Allow-Origin' header is present
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM