无法使用应用程序脚本在DOMWindow上执行PostMessage [英] Failed to execute PostMessage on DOMWindow using apps script

查看:54
本文介绍了无法使用应用程序脚本在DOMWindow上执行PostMessage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用apps脚本打开Web应用程序时,偶尔会收到以下错误消息.

I am getting the following error message occasionally when I open my web-app with apps script.

需要澄清两个问题

  • 这是什么错误?
  • 我该如何解决?

我需要该网站明显地持续运行,所以如果解决方案不明显,我愿意在几天之内启动赏金计划.我多次调用google.script.run函数.

I need this website to run consistently obviously so I am willing to start a bounty in a few days if the solution is not obvious. I make many calls to google.script.run functions.

Failed to execute 'postMessage' on 'DOMWindow': 
The target origin provided 
('https://n-j3xfpwqmogabbvlhsvezfcvbljow7bq45m6qoky-0lu-script.googleusercontent.com') 
does not match the recipient window's origin ('null').

我可能应该提到我的应用程序包含jquery,但是当我删除下面的脚本和Css标签时,没有任何整体效果.有时只是由于没有明显的原因而没有加载.

I should probably mention that my app contains jquery, but when I remove the script and Css tags below there is no overall effect. It just simply is not loading sometimes for no apparent reason.

 <script   src="https://code.jquery.com/jquery-3.1.0.js"   integrity="sha256-slogkvB1K3VOkzAI8QITxV3VzpOnkeNVsKvtkYLMjfk="   crossorigin="anonymous"></script>
  <script   src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"   integrity="sha256-0YPKAwZP7Mp3ALMRVB2i8GXeEndvCq3eSl/WsAl1Ryk="   crossorigin="anonymous"></script>
  <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" />
  <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>

推荐答案

基于错误无法在DOMWindow上执行postMessage ,您可能未从

Based from the error Failed to execute postMessage on DOMWindow you might not properly configured your credentials from Google API console or you are trying to run your script from the file system instead of web server even running on localhost

只需确保已加载发布消息.在大多数情况下,发送邮件加载失败时会发生此错误.

Just make sure that posting message is loaded. Most of the time this error occurred when sending messages failed to load.

尝试在此处查看社区建议的解决方法:SOTicket2 .

Try to check workaround suggested by community here: SOTicket1 or SOTicket2.

这篇关于无法使用应用程序脚本在DOMWindow上执行PostMessage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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