Google应用程序脚本在web应用程序中的location.reload [英] Google apps script location.reload in web app

查看:97
本文介绍了Google应用程序脚本在web应用程序中的location.reload的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个GAS web应用程序,当用户采取某些操作时(例如点击特定div),需要刷新其内容。



在客户端,我有这个从onclick调用的脚本

  google.script.run.withSuccessHandler(refreshCallback).myServersideFunction(); 

函数refreshCallback(roomsPlus){
var statusDiv = document.getElementById(status);
statusDiv.innerHTML =重新加载...;
window.location.reload(true);
};

状态div更改为重新加载...,所以我知道回调被调用,但随后它永远不会重新加载页面。 Caja或谷歌应用程序脚本是否禁用页面刷新?有没有另外一种方法来刷新页面?

$ b Caja已于2016年7月16日从Web应用程序HtmlService中移除。



原生Sandbox模式



HTML服务更新



编辑结束



不幸的是,HtmlService使用的Caja清理引擎限制对窗口对象的访问,从而阻止您以编程方式重新加载页面。这是该服务的一个已知限制,我们正在努力更好地记录它。


I am using a GAS web app that needs to refresh its contents when a user takes certain actions (like clicking on a particular div).

On the clientside, I have this script that gets called from onclick

google.script.run.withSuccessHandler(refreshCallback).myServersideFunction();

function refreshCallback(roomsPlus) {
    var statusDiv = document.getElementById("status");
    statusDiv.innerHTML = "Reloading...";
    window.location.reload(true);
};

The status div changes to "Reloading..." so I know the callback gets called,but then it never reloads the page. Does Caja or google apps script disable page refreshing? Is there another way to refresh the page?

解决方案

EDIT

Caja was removed July 16, 2016 from Web App HtmlService.

Native Sandbox Mode

An Update to HTML Service

End of edit

Unfortunately the Caja sanitization engine used by HtmlService restricts access to the window object, preventing you from programatically reloading the page. This is a known restriction of the service and we are working to better document it.

这篇关于Google应用程序脚本在web应用程序中的location.reload的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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