简体   繁体   English

Google Apps脚本无法在Chrome中使用

[英]Google Apps Script not working in Chrome

I have a simple test google apps script that prints the content of a sheet. 我有一个简单的测试谷歌应用程序脚本,可以打印工作表的内容。 It works fine in Safari on Mac but on Chrome I get a blank page with this error in the console: 它在Mac上的Safari中工作正常但在Chrome上我在控制台中出现此错误的空白页:

dropping postMessage.. was from unexpected window drop postMessage ..来自意外窗口

This is the code: 这是代码:

    function doGet() {
  return HtmlService
      .createTemplateFromFile('index')
      .evaluate();
}

function getData() {
  return SpreadsheetApp
      .openById('1vyrKW7ABfCDY-a8H4AZ2JFZwA7lpCEuD6R5x4fJ8_qI')
      .getActiveSheet()
      .getDataRange()
      .getValues();
}

Here is the HTML template: 这是HTML模板:

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    <? var data = getData(); ?>
    <table>
      <? for (var i = 0; i < data.length; i++) { ?>
        <tr>
          <? for (var j = 0; j < data[i].length; j++) { ?>
            <td><?= data[i][j] ?></td>
          <? } ?>
        </tr>
      <? } ?>
    </table>
  </body>
</html>

And here is the published web app: https://script.google.com/macros/s/AKfycbyYiAlqtqElFeyiWD6yq2zWtzQ1vdJMkHUPOfZrQFvicTO_uXs/exec 以下是已发布的网络应用: https//script.google.com/macros/s/AKfycbyYiAlqtqElFeyiWD6yq2zWtzQ1vdJMkHUPOfZrQFvicTO_uXs/exec

It is a known issue with the latest version of Google Chrome. 这是最新版Google Chrome的已知问题。 If you open the web app inside Firefox, it would work just fine. 如果您在Firefox中打开Web应用程序,它会正常工作。

Please star this issue on code.google.com for updates. 请在code.google.com上为此问题加注星标以获取更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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