首页 > 解决方案 > 获取控制台错误'Uncaught TypeError:无法读取此行的属性'run' of undefined':google.script.run

问题描述

这发生在 Chrome 上,但不在我的 Iphone 7 上,也不在 Firefox 上。它在 V8 和 Rhino 中都失败了

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>


 $(function(){  
      google.script.run//this is the line
      .withSuccessHandler(function(vA) {
        $('#sel1').css('background-color','#ffffff');
        updateSelect(vA);
      })
      .getSelectOptions();

      google.script.run
      .withSuccessHandler(function(hl) {
        document.getElementById('dt1').innerHTML=hl;
      })
      .getTimeStamp();  
    });

这是我清除的:

在此处输入图像描述

为什么清除我的浏览器数据可以解决这个问题?

我在控制台中注意到了这个警告。我想知道这是否与它有关。

与http://google.com/上的跨站点资源关联的 cookie设置为没有该SameSite属性。SameSite=None它已被阻止,因为 Chrome 现在仅在使用和设置时才提供带有跨站点请求的 cookie Secure。您可以在应用程序>存储>Cookies 下的开发人员工具中查看 cookie,并在https://www.chromestatus.com/feature/5088147346030592https://www.chromestatus.com/feature/5633521622188032中查看更多详细信息。

标签: google-chromegoogle-apps-scriptiframeweb-applications

解决方案


推荐阅读