Closed
Description
Socket.io client library does not work when using it with XHTML documents with cross domain access
How can I reproduce the problem?
- Start socket.io server on http://localhost:8888
- Save https://gist.github.com/15fc854708f97cb9323e in test.html and test.xhtml
- Open test.html and test.xhtml at http://localhost:4444/test.(html|xhtml)
What am I expected to see?
Both documents should alert "Connected", but only the .html variant works. Tested browsers: FF5, Safari 5.1, Chrome
What might cause the issue?
In a cross-domain environment, a "SCRIPT" tag instead of a "script" tag is inserted. XHTML is based on XML and is case insenstive. XHTML tags should be in lower case (http://www.w3.org/TR/xhtml1/#h-4.2). The following fix in /socket.io/
socket.io.js, line 1539, should solve the issue:
- , script = document.createElement('script');