Closed ghost closed 13 years ago
Hi LawSimply,
I couldn't reproduce the bug on IE8 or 7. If you open the debug window (F12) and click the script tab, are there any additional error messages printed?
ericz, thanks for the reply!
It doesn't show any additional errors but it points to this code:
(function(){
var dependencies = ["/socket.io/socket.io.js"];
var dependenciesLoaded = 0;
var nowJSScriptLoaded = function(){
dependenciesLoaded++;
if(dependenciesLoaded !== dependencies.length) {
return;
}
nowUtil.debug("isIE", isIE);
socket = new io.Socket('localhost', {port: 9000}); // According to IE, this line here is the cause.
socket.connect();
socket.on('connect', function(){
var client = socket;
client.sessionId = SERVER_ID;
nowLib.handleNewConnection(client);
nowCore.emit('connect');
});
};
for(var i in dependencies){
if(dependencies.hasOwnProperty(i)){
var fileref=document.createElement('script');
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", "http://localhost:9000"+dependencies[i]);
fileref.onload = nowJSScriptLoaded;
if(isIE) {
fileref.onreadystatechange = function () {
if(fileref.readyState === "loaded") {
nowJSScriptLoaded();
}
};
}
document.getElementsByTagName("head")[0].appendChild(fileref);
}
}
}());
Alright. So I've added the script tag before including now.js, pointing to socket.io:
<script type="text/javascript" src="/socket.io/socket.io.js"></script>
And the error is gone.
UPDATE: It seems that now.ready event won't be fired, even after adding socket.io explicitly. Though I have solved this problem for myself by replacing those functions with old ajax calls(at this time, I was using now.js for remote function calling, not for realtime stuff anyways). I guess, if no one else is having this problem then there could be something wrong with my code. Anyway. I appreciate your help and Now.js is what makes me want to use Node.js even more. Keep up the awesome work! -- LawSimply
Thanks man but this is very strange. I can't seem to replicate it unfortunately
Wonder why dependencies
being an array, we iterate over it via for in
. This can be the clue
@dvv I have fixed that in latest master. Not sure if it'll fix original issue (possible, if array prototype was being extended)
When now.js(v0.5.3) is done loading in IE8, I get this error:
Any ideas how to fix that?
Thanks!