When using node.js and socket.io, why can't I just open the client.html file instead of typing localhost in the address bar?
I am just curious. I think it has something to do with that socket.io temporary file, but I don't really get it...
Browsers generally don't allow HTTP requests to be made to domains different than the one the page is on. So a client.html file that's opened as a "file://..." URL in the browser can only talk to other "file://..." urls. (i.e static pages only). However socket.io requires a real webserver on the backend, so it has to be "http://..."
There are also other considerations, around how file:// urls are treated differently. (e.g. you can't set cookies, XHR requests to file:// urls don't have HTTP status codes, etc.)