Fusion Tables 不支持 CORS(跨源资源共享)?
从第 554 期的评论来看,我认为认为 Fusion Tables 支持 CORS 请求。但尝试以下操作会出现跨站点错误(在 Chrome 中):
xhr = new XMLHttpRequest()
xhr.open("GET","http://www.google.com/fusiontables/api/query?sql=SELECT%20*%20FROM%201906375")
xhr.send()
错误是:Access-Control-Allow-Origin 不允许 Origin http://[domain]。
以下示例工作正常(为了比较),一个简单的 PHP 页面,我在其中设置“CORS”标头并回显原始服务器,例如“hello example.com”:
xhr = new XMLHttpRequest()
xhr.open("GET","http://skipperkongen.dk/services/corstest/hellocors.php")
xhr.send()
我必须承认,我在网络上没有找到明确说明融合表的地方支持 CORS,但我有点期待它(也根据该问题中的评论)...
我做错了吗?
Judging by the comments on issue 554, I would think that Fusion Tables had support for CORS requests. Trying the following though gives a cross site error (in Chrome):
xhr = new XMLHttpRequest()
xhr.open("GET","http://www.google.com/fusiontables/api/query?sql=SELECT%20*%20FROM%201906375")
xhr.send()
The error is: Origin http://[domain] is not allowed by Access-Control-Allow-Origin.
The following example works fine (for comparison), a simple PHP page where I set the "CORS" header and echo the origin server back like, "hello example.com":
xhr = new XMLHttpRequest()
xhr.open("GET","http://skipperkongen.dk/services/corstest/hellocors.php")
xhr.send()
I must admit that I've found nowhere on the web that explicitly says that fusion tables supports CORS, but I kind of expect it (judging also by the comments in the issue)...
Am I doing it wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
仅针对(未记录且可能会更改)JSONP 接口更新标头:
http:// /www.google.com/fusiontables/api/query?sql=&jsonCallback=
The headers were updated only for the (undocumented and subject to change) JSONP interface:
http://www.google.com/fusiontables/api/query?sql=&jsonCallback=