XMLHttpRequest cross site scripting on same server but differnt port

Posted by clamp on Stack Overflow See other posts from Stack Overflow or by clamp
Published on 2011-01-12T13:50:38Z Indexed on 2011/01/12 13:54 UTC
Read the original article Hit count: 175

Filed under:
|

hello, using XMLHttpRequest it is not possible to open a connection to a document on a different domain than where the page itself is hosted.

but what about different ports?

for example i have a webserver running on my machine listening on port 80 so the webaddress would look like this:

http://localhost:80/mypage.html

and i have another webserver running on localhost which is meant to process the ajax requests but listens on a different port. so the javascript in mypage.html would look like this:

var xmlhttprequest = new XMLHttpRequest(); 
xmlhttp.open("GET", "http://localhost:1234/?parameters", true); 
xmlhttp.send();

would this work? or will it give a security exception as well?

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about xmlhttprequest