<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>PhaserJS on Lin's Blog</title><link>http://coder.tw/tags/phaserjs/</link><description>Recent content in PhaserJS on Lin's Blog</description><generator>Hugo</generator><language>zh-tw</language><lastBuildDate>Fri, 02 Dec 2016 14:01:31 +0000</lastBuildDate><atom:link href="http://coder.tw/tags/phaserjs/index.xml" rel="self" type="application/rss+xml"/><item><title>Enable Cross-Origin Resource Sharing (CORS) for Phaser.js</title><link>http://coder.tw/posts/enable-cross-origin-resource-sharing-cors-for-phaser-js/</link><pubDate>Fri, 02 Dec 2016 14:01:31 +0000</pubDate><guid>http://coder.tw/posts/enable-cross-origin-resource-sharing-cors-for-phaser-js/</guid><description>&lt;p&gt;當你用 Phaser JS 載入不同網域的資源、素材時，就會遇到瀏覽器同源政策的阻擋，並冒出一堆錯誤訊息，例如：&lt;/p&gt;
&lt;blockquote&gt;XMLHttpRequest cannot load http://s.ntustcoding.club/scroll-game-workshop/map.json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://s.codepen.io' is therefore not allowed access.&lt;/blockquote&gt;
實際上，Phaser 本身是有支援 跨來源資源共享 CORS 的，只要透過一行簡單的語法就可以解決囉，當然前提是你所使用的網路空間也有支援 CORS 才行。</description></item></channel></rss>