简体   繁体   中英

IFRAME and NATIVE Mode in Google Apps Script

I have created a google apps script to display some indicators with images. I have used the following code function doGet() { var output= HtmlService.createHtmlOutputFromFile('cfcgfcg'); output.setSandboxMode(HtmlService.SandboxMode.IFRAME); return output; } The code works fine in NATIVE mode, but it does not work with IFRAME mode. I have tried the guidlines to migrate from NATIVE to IFRAME given in the following link https://developers.google.com/apps-script/migration/iframe#setting_the_link_target_attribute

But the code doesn't work

Following is the code I have used https://drive.google.com/open?id=1C9_tabVhPq1NhKBjqNATvdC5G9542A8rRqhxpa-BSknx8m19Kts6bsB-

it seems that you used a wrong url to load JQuery lib, Use console to see the error messages using this one hosted on https server works in IFRAME mode :

<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>

Check if it runs on load by adding a log for example

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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