“Object #has no method ‘isXDomain'”

2012.03.11 | Javascript | , , , ,

If you’re using Socket.IO with NodeJS, Firefox reports the error “this.isXDomain is not a function” while Chrome complains with “Object #<Object> has no method ‘isXDomain‘”.

The solution to this problem has nothing to do with Cross Domain policies, it just happens to be the first place the Socket.IO script fails when you forget to create the socket with the ‘new’ keyword.

So change your code that looks like this:

this.socket = io.Socket('localhost', {port: 8888} );

to

this.socket = new io.Socket('localhost', {port: 8888} );
  • Ray Hibnes

    Life saver!