簡體   English   中英

Google Apps腳本中的IFRAME和NATIVE模式

[英]IFRAME and NATIVE Mode in Google Apps Script

我創建了一個Google Apps腳本來顯示一些帶有圖像的指示器。 我已經使用以下代碼函數doGet(){var output = HtmlService.createHtmlOutputFromFile('cfcgfcg'); output.setSandboxMode(HtmlService.SandboxMode.IFRAME); 返回輸出; }該代碼在NATIVE模式下可以正常工作,但在IFRAME模式下不能正常工作。 我已經嘗試了以下鏈接https://developers.google.com/apps-script/migration/iframe#setting_the_link_target_attribute中給出的從NATIVE遷移到IFRAME的指南

但是代碼不起作用

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

似乎您使用了錯誤的URL來加載JQuery庫,使用控制台查看使用HTTPS服務器上托管的該URL的錯誤消息在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();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM