diff options
author | Hiroshi Ichikawa <gimite@gmail.com> | 2011-06-26 10:53:21 +0900 |
---|---|---|
committer | Hiroshi Ichikawa <gimite@gmail.com> | 2011-06-26 10:53:21 +0900 |
commit | c6b157474f313660edca568ccc76035276e2da14 (patch) | |
tree | 11d965482446cbe85762f5fe1ab77c31f2f1995d | |
parent | d8405960214b5a590693c9e738e150b1f87ceafd (diff) | |
download | web-socket-js-c6b157474f313660edca568ccc76035276e2da14.tar.gz |
Adding error message when HTML and SWF is in the different domains.
-rw-r--r-- | web_socket.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/web_socket.js b/web_socket.js index bf81019..3cabbd4 100644 --- a/web_socket.js +++ b/web_socket.js @@ -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 |