How Do I Access an Arbitrary Server using XMLHttpRequest?

X

xcampanoli

It looks from examples I'm digging up that the natural thing is to
only use XMLHttpRequest to access the originating server, but I'm
seeing some examples where multiple full URLs are used. What are the
rules for this, and where can I find the document for those rules?
 
P

Peter Michaux

It looks from examples I'm digging up that the natural thing is to
only use XMLHttpRequest to access the originating server, but I'm
seeing some examples where multiple full URLs are used. What are the
rules for this, and where can I find the document for those rules?

Pages from all of these URLs can XHR to the servers associated with
each other
example.com
alpha.example.com
beta.example.com

Pages with the above URLs cannot talk with the server for
asdf.com

For XHR the protocol has to be the same also. So pages from http:
cannot make requests to https:, for example.

Peter
 
D

Darko

Pages from all of these URLs can XHR to the servers associated with
each other
example.com
alpha.example.com
beta.example.com

Pages with the above URLs cannot talk with the server for
asdf.com

For XHR the protocol has to be the same also. So pages from http:
cannot make requests to https:, for example.

Peter

That is true, except for Internet Explorer. Tested it.
 
A

augustus kling

That is true, except for Internet Explorer. Tested it.

You have to use an server-side script that reads data from an other
server and sends it to the client in other browsers.
If your script is loaded via a local protocol (local file) you can ask
the browser for more privileges. This case is true for example if
Firefox loaded a local file or when your script is part of an
extension.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,880
Members
47,417
Latest member
DarrenGaun

Latest Threads

Top