gimite / web-socket-js

HTML5 Web Socket implementation powered by Flash
BSD 3-Clause "New" or "Revised" License
2.74k stars 490 forks source link

Line 65 Error in IE8 #150

Open shahraship opened 10 years ago

shahraship commented 10 years ago

I tried to load this up in IE8 and I'm getting an error on line 65:

WebSocket.__flash.create(): Object doesn't support this property or method.

WebSocket.__flash seems like a valid object, however the "create" seems to be failing.

I have Flash Player 12 installed. The SWF seems to be loading just fine, however, I see this error upon initialization through JavaScript.

gimite commented 10 years ago

Hmm I'm not sure why. Can you try "Troubleshooting" section in: https://github.com/gimite/web-socket-js

Especially follow Step 1 and see if you get any other log messages?

I'll try to see if I can reproduce.

gimite commented 10 years ago

Especially follow Step 1 and see if you get any other log messages?

I mean the step to put WEB_SOCKET_DEBUG = true. There seems to be two "Step 1" :)

shahraship commented 10 years ago

I think I understand why that happens now. I look at the sample.html code and it works in the same browser. The main difference between what I have vs. sample.html is that, it uses body onload, which waits for flash to be loaded as well. However, in my application, I'm using requirejs to load this module. Once the module is loaded, I then attempt to connect with socket right away. Seems like flash isn't completely loaded at that time and that is why the above error is thrown.

I'm however not quiet sure about what is the best way to fix this is.

reklis commented 10 years ago

require(['domReady'], function (domReady) { domReady(function () { //This function is called once the DOM is ready. //It will be safe to query the DOM and manipulate //DOM nodes in this function. }); });

http://requirejs.org/docs/api.html#pageload

gimite commented 10 years ago

Sorry I forgot to follow up on this thread. web-socket-js queues actual process until Flash object is ready, so it should work even if you use WebSocket immediately after loading web_socket.js. I verified that it works with IE11. But there may be an issue specific to IE8. It may be safer to wait until onload.