Skip to content

Commit

Permalink
Adding error message when HTML and SWF is in the different domains.
Browse files Browse the repository at this point in the history
  • Loading branch information
gimite committed Jun 26, 2011
1 parent d840596 commit c6b1574
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions web_socket.js
Expand Up @@ -226,6 +226,17 @@
console.error("[WebSocket] set WEB_SOCKET_SWF_LOCATION to location of WebSocketMain.swf");
return;
}
if (!WEB_SOCKET_SWF_LOCATION.match(/(^|\/)WebSocketMainInsecure\.swf(\?.*)?$/) &&
WEB_SOCKET_SWF_LOCATION.match(/^\w+:\/\/([^\/]+)/)) {
var swfHost = RegExp.$1;
if (location.host != swfHost) {
console.error(
"[WebSocket] You must host HTML and WebSocketMain.swf in the same host " +
"('" + location.host + "' != '" + swfHost + "'). " +
"See also 'How to host HTML file and SWF file in different domains' section " +
"in README.md.");
}
}
var container = document.createElement("div");
container.id = "webSocketContainer";
// Hides Flash box. We cannot use display: none or visibility: hidden because it prevents
Expand Down

0 comments on commit c6b1574

Please sign in to comment.