【问题标题】:Load google web app to a web page将谷歌网络应用加载到网页
【发布时间】:2014-07-29 12:11:05
【问题描述】:

使用 google 脚本,我编写了一个简单的 Web 应用程序,该应用程序返回用户电子邮件,部署它并且工作正常 - 返回活动用户的电子邮件。 问题是我要在 html 页面上显示该用户的电子邮件,例如:

脚本:

$(document).ready(function(){
$('#userID').load('---web app url---');
});

HTML:

<p>Active user:</p>
<div id="userID"></div>

我得到错误 meggase:

XMLHttpRequest cannot load /web app url here/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

据我了解,问题在于启用 CORS,但我找不到解决方案。 如何将该谷歌网络应用加载到我的 html 页面?

我没有服务器,它是一个简单的 html 页面,我相信这个问题必须有一个简单的解决方案。

谢谢。

【问题讨论】:

    标签: javascript jquery html google-app-engine


    【解决方案1】:

    我不太清楚您要做什么,但要启用 CORS,您可以在服务器上执行此操作,例如在 python 中使用 webapp

    self.response.headers.add_header("Access-Control-Allow-Origin", "*")

    如果您没有服务器,您要访问谁的服务器?

    【讨论】:

    • 谷歌的。我写了一个谷歌应用程序脚本(它在我的谷歌驱动器上)并将其部署为网络应用程序。现在我需要将该网络应用程序包含在我的另一个网页中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-12-12
    • 2012-06-14
    • 1970-01-01
    • 1970-01-01
    • 2016-03-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多