我目前正在嘗試使用 Google App Engine/Go + Polymer.dart 網(wǎng)站http://xclamm.appspot.com/。問題是當(dāng)我使用Dartium (31.0.1612.0 Developer Build 219647)訪問http://xclamm.appspot.com/時出現(xiàn)以下錯誤。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. 我做了一些研究,發(fā)現(xiàn)問題與我如何引用有關(guān)/_ah/channel/jsapi,但我找不到如何解決它。我嘗試了以下方法來引用 channel.js,但仍然出現(xiàn)相同的錯誤。<!-- 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 上運行網(wǎng)站,它似乎工作正常。我錯過了什么嗎?源代碼可在https://github.com/rillomas/xclamm-gae 獲得,我使用的是 Google App Engine SDK 1.8.4 for Go (x64 Windows)。
1 回答

莫回?zé)o
TA貢獻1865條經(jīng)驗 獲得超7個贊
我將<script type="text/javascript" src="/_ah/channel/jsapi"></script>
標(biāo)簽從main-stage.html
(內(nèi)部 Web 組件的index.html
html )移動到(網(wǎng)站的根 html),然后 CORS 錯誤消失了。
該<script>
標(biāo)簽最初被放置在一個<polymer-element>
標(biāo)簽內(nèi),并且(可能)被 Polymer.dart 轉(zhuǎn)換為 XMLHttpRequest,從而導(dǎo)致錯誤。
- 1 回答
- 0 關(guān)注
- 231 瀏覽
添加回答
舉報
0/150
提交
取消