summaryrefslogtreecommitdiff
path: root/web_socket.js
diff options
context:
space:
mode:
Diffstat (limited to 'web_socket.js')
-rw-r--r--web_socket.js18
1 files changed, 5 insertions, 13 deletions
diff --git a/web_socket.js b/web_socket.js
index aa7c5ea..0037d68 100644
--- a/web_socket.js
+++ b/web_socket.js
@@ -370,20 +370,12 @@
};
if (!window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION) {
- var init = function(){
+ // NOTE:
+ // This fires immediately if web_socket.js is dynamically loaded after
+ // the document is loaded.
+ swfobject.addDomLoadEvent(function() {
WebSocket.__initialize();
- };
- if (document.readyState == "complete") {
- // Document is already loaded.
- init();
- } else if (window.addEventListener) {
- // This fires earlier but is not supported by all browsers.
- document.addEventListener("DOMContentLoaded", init, false);
- // This is supported by all browsers.
- window.addEventListener("load", init, false);
- } else {
- window.attachEvent("onload", init);
- }
+ });
}
})();