Google Apps脚本无法在Chrome中使用 [英] Google Apps Script not working in Chrome

查看:125
本文介绍了Google Apps脚本无法在Chrome中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的测试google apps脚本,用于打印表单的内容。它在Mac上的Safari浏览器中正常工作,但在Chrome上,我在控制台中出现了一个空白页面,并显示此错误:

正在从意外的窗口中删除postMessage ..



这是代码:

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

函数getData(){
返回SpreadsheetApp
.openById('1vyrKW7ABfCDY-a8H4AZ2JFZwA7lpCEuD6R5x4fJ8_qI')
.getActiveSheet()
。 getDataRange()
.getValues();
}

以下是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>

以下是已发布的网络应用:
https://script.google.com/macros/s/AKfycbyYiAlqtqElFeyiWD6yq2zWtzQ1vdJMkHUPOfZrQFvicTO_uXs/exec

解决方案

这是最新版Google Chrome的一个已知问题。如果您在Firefox内部打开网页应用程序,它就可以正常工作。



请在 code.google.com 更新。


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:

dropping postMessage.. was from unexpected window

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:

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

解决方案

It is a known issue with the latest version of Google Chrome. If you open the web app inside Firefox, it would work just fine.

Please star this issue on code.google.com for updates.

这篇关于Google Apps脚本无法在Chrome中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆