【问题标题】:IFRAME and NATIVE Mode in Google Apps ScriptGoogle Apps 脚本中的 IFRAME 和 NATIVE 模式
【发布时间】:2016-07-22 01:05:36
【问题描述】:

我创建了一个谷歌应用程序脚本来显示一些带有图像的指标。 我使用了以下代码 函数 doGet() { var output= HtmlService.createHtmlOutputFromFile('cfcgfcg'); output.setSandboxMode(HtmlService.SandboxMode.IFRAME); 返回输出; } 该代码在 NATIVE 模式下工作正常,但不适用于 IFRAME 模式。我已经尝试了以下链接中给出的从 NATIVE 迁移到 IFRAME 的指导方针 https://developers.google.com/apps-script/migration/iframe#setting_the_link_target_attribute

但代码不起作用

以下是我使用的代码 https://drive.google.com/open?id=1C9_tabVhPq1NhKBjqNATvdC5G9542A8rRqhxpa-BSknx8m19Kts6bsB-

【问题讨论】:

    标签: javascript html google-apps-script


    【解决方案1】:

    似乎你使用了错误的 url 来加载 JQuery 库,使用控制台查看错误消息 使用托管在 https 服务器上的这个可以在 IFRAME 模式下工作:

    <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    <script src="https://apis.google.com/js/api.js?onload=onApiLoad"></script>
    

    例如通过添加日志来检查它是否在加载时运行

    function update() {
        console.log("update executed");
        $.ajaxSetup({ cache: false });
        var data=google.script.run.withSuccessHandler(onSuccess).getMyData();
        window.setTimeout(update, 500);
    }
    update();
    

    【讨论】:

      猜你喜欢
      • 2017-04-12
      • 2016-10-12
      • 1970-01-01
      • 2020-11-11
      • 2021-05-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多