编辑:此问题似乎仅在使用 Chrome 时发生。如果我们使用 Edge,它就可以工作。
我已在此页面重新创建了该问题。对于我自己和辅助虚拟帐户,这工作正常,但对其他用户不起作用。
我有两个服务器端功能
受影响的用户以与我相同的方式授权脚本后,他单击按钮并出现模式对话框,但 getDinner() 从未运行。我在项目执行页面确认了这一点。他们只剩下“牛排和”了。我们尝试撤销访问并重新授权,但这似乎没有任何作用。
代码.gs文件
function showModal(){
var templ = HtmlService.createTemplateFromFile('template');
templ = templ.evaluate().setWidth(1500).setHeight(793);
SpreadsheetApp.getUi().showModalDialog(templ,'Here\s what I had for Dinner:');
}
function getDinner(){
return 'potatoes'
}
template.html 文件
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<script>
google.script.run.withSuccessHandler(showDinner).getDinner();
function showDinner(dinner){
document.getElementById("side").innerHTML = dinner
}
</script>
</head>
<body>
<p>Steak and <span id="side"></span></p>
</body>
</html>