GAS:無法在 Firefox 中使用 HtmlService 自定對鬆式

GAS: Unable to use HtmlService custom dialogs in Firefox

本文关键字:HtmlService Firefox GAS      更新时间:2023-09-26

我正在尝试在Google Apps Script中创建自定义对话框,如下所示:

function onOpen() {   
  SpreadsheetApp.getUi() 
  .createMenu('Custom Menu')
  .addItem('Show dialog', 'showDialog')
  .addToUi();
}
function showDialog() {
  var html = HtmlService.createHtmlOutputFromFile('Page')
      .setSandboxMode(HtmlService.SandboxMode.IFRAME)
      .setWidth(400)
      .setHeight(300);
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .showModalDialog(html, 'My custom dialog');
}

Page.html在哪里:

Hello, world! <input type="button" value="Close" onclick="google.script.host.close()" />

在Chrome中,它按预期工作。在Firefox 34中,对话框显示,但是当我单击关闭按钮时,它不会触发回调google.script.host.close()

Firebug 报告错误:

ReferenceError: google is not defined  userCodeAppPanel (line 1)
这是

FF/IE的已知错误,请使用本机沙盒直到修复并遵循 https://code.google.com/p/google-apps-script-issues/issues/detail?id=4617 中的问题。