Pregunta

I'm currently experimenting with a Google App Engine/Go + Polymer.dart website at http://xclamm.appspot.com/.

The problem is that I get the following error when I access http://xclamm.appspot.com/ with Dartium (31.0.1612.0 Developer Build 219647).

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. 

I did some research and found that the problem is related with how I refer to /_ah/channel/jsapi, but I can't find how to fix it. I tried the following ways to refer to channel.js, but I still get the same error.

<!-- 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>

If I run the website on dev_appserver.py, it seems to be working OK. Am I missing something?

The source code is available at https://github.com/rillomas/xclamm-gae, and I'm using Google App Engine SDK 1.8.4 for Go (x64 Windows).

¿Fue útil?

Solución

I moved the <script type="text/javascript" src="/_ah/channel/jsapi"></script> tag from main-stage.html (html for an internal web component) to index.html (root html for the website), and the CORS error went away.

The <script> tag was originally placed inside a <polymer-element> tag, and was (probably) translated to an XMLHttpRequest by Polymer.dart, causing the error.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top