亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

獲取 Channel API 客戶端腳本時出現 CORS 相關錯誤

獲取 Channel API 客戶端腳本時出現 CORS 相關錯誤

Go
達令說 2021-06-08 09:02:00
我目前正在嘗試使用 Google App Engine/Go + Polymer.dart 網站http://xclamm.appspot.com/。問題是當我使用Dartium (31.0.1612.0 Developer Build 219647)訪問http://xclamm.appspot.com/時出現以下錯誤。XMLHttpRequest cannot load https://talkgadget.google.com/talkgadget/channel.js. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://xclamm.appspot.com' is therefore not allowed access. 我做了一些研究,發現問題與我如何引用有關/_ah/channel/jsapi,但我找不到如何解決它。我嘗試了以下方法來引用 channel.js,但仍然出現相同的錯誤。<!-- Following doesn't work --><script type="text/javascript" src="/_ah/channel/jsapi"></script><!-- Following doesn't work either --><script type="text/javascript" src="https://talkgadget.google.com/talkgadget/channel.js"></script>如果我在 dev_appserver.py 上運行網站,它似乎工作正常。我錯過了什么嗎?源代碼可在https://github.com/rillomas/xclamm-gae 獲得,我使用的是 Google App Engine SDK 1.8.4 for Go (x64 Windows)。
查看完整描述

1 回答

?
莫回無

TA貢獻1865條經驗 獲得超7個贊

我將<script type="text/javascript" src="/_ah/channel/jsapi"></script>標簽從main-stage.html(內部 Web 組件的index.htmlhtml )移動到(網站的根 html),然后 CORS 錯誤消失了。

<script>標簽最初被放置在一個<polymer-element>標簽內,并且(可能)被 Polymer.dart 轉換為 XMLHttpRequest,從而導致錯誤。


查看完整回答
反對 回復 2021-06-28
  • 1 回答
  • 0 關注
  • 236 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號