IFRAME和谷歌应用程序脚本中的NATIVE模式

IFRAME and NATIVE Mode in Google Apps Script

本文关键字:NATIVE 模式 脚本 谷歌 应用程序 IFRAME      更新时间:2023-12-03

我创建了一个谷歌应用程序脚本来显示一些带有图像的指示符。我使用了以下代码函数doGet(){var output=HtmlService.createHtmlOutputFromFile('fcgfcg');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-

您似乎使用了错误的url来加载JQuerylib,使用控制台查看错误消息使用托管在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();