简体   繁体   English

GAS中的Access-Control-Allow-Origin标头

[英]Access-Control-Allow-Origin headers in GAS

I am sending an (HTTP GET) $.ajax request (from jsfiddle) to my Google Apps Script server and I get the following error: 我发送(HTTP GET)$ .ajax请求(来自jsfiddle)到我的Google Apps脚本服务器,我收到以下错误:

XMLHttpRequest cannot load https://script.google.com/macros/s/mykey?params . XMLHttpRequest无法加载https://script.google.com/macros/s/mykey?params

Origin http://fiddle.jshell.net is not allowed by Access-Control-Allow-Origin. Access-Control-Allow-Origin不允许使用来源http://fiddle.jshell.net

What is the best way to solve this problem? 解决这个问题的最佳方法是什么?

I have successfully implemented jsonp $.ajax requests to retrieve json data and javascript using this GAS/jsfiddle configuration. 我已经成功实现了jsonp $ .ajax请求,以使用此GAS / jsfiddle配置检索json数据和javascript。 However, I seem unable to accomplish this jsonp success this time. 但是,这次我似乎无法完成这次jsonp的成功。 Possibly because I am going through an .updaterow() function (per jqWidgets?) 可能是因为我正在通过.updaterow()函数(每个jqWidgets?)

My research: 我的研究:

  1. This post almost asks a similar question except it is not specific to GAS. 这篇文章几乎提出了一个类似的问题,除了它不是特定于GAS。
  2. I do not think GAS allows one to set server-side response headers. 我认为GAS不允许设置服务器端响应头。 But surely there must be a way to get my request to execute? 但肯定有办法让我的请求执行?
  3. Perhaps this question explains it better? 也许这个问题解释得更好? ( GAS issue ) Is there a workaround solution? GAS问题 )是否有解决方案? (Come on creative people.) (来吧有创意的人。)

GAS目前不允许使用CORS头。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM