javascript - Why would XML be an issue with a MEAN stack application, and what is this error about? -


i working on socket.io "hello world" via mean stack application, , right away chrome tossing funky errors way. honest, in debugging effort, i'm not sure begin. initial questions were:

  • why xml being used instead of json?
  • what no 'access-control-allow-origin' header present on requested resource. mean?

the entire error message below, , in advance advice y'all able give.

cheers,

peter

xmlhttprequest cannot load http://localhost/socket.io/?eio=3&transport=polling&t=1435600202687-6. no 'access-control-allow-origin' header present on requested resource. origin 'http://localhost:9000' therefore not allowed access. response had http status code 404. 

try including socket.io lib directly socket server:

<script src="http://localhost:9000/socket.io/socket.io.js"></script> 

the error "no 'access-control-allow-origin' header present on requested resource." means server doesn't allow extern resource connect.

additionally can set allowed origins directly in io setup e.g:

var io = require('socket.io')(server, {origins:'page.com:* http://page.com:* http://www.page.com:*'}); 

Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -