I thought that I understood the same origin policy, but then my code worked...who would have thought?

I have a multiplayer game written in JavaScript that communicates with the backend using the Strophe XMPP library. It works great even thou the game is hosted at one machine and the XMPP server at another.

Basically I run my game on localhost, but the Strophe connection goes to a different machine and port. How is that possible?

Strophe uses long-polling XHR requests, and no, I do not use the Flash fallback.

有帮助吗?

解决方案

The server can opt in to allow cross origin requests with Cross-origin resource sharing (CORS). CORS wikipedia. CORS MDN

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top