Cross domain calls, REST library

14,462

There is CORS for modern browsers. Then there are a couple of other hacks, described very well here: Ways to circumvent the same-origin policy.

Otherwise you'll have to do the server side programming.

Share:
14,462
Henrik Kjus Alstad
Author by

Henrik Kjus Alstad

Updated on June 04, 2022

Comments

  • Henrik Kjus Alstad
    Henrik Kjus Alstad almost 2 years

    I'm trying to use an external REST Library for my application, and I'm hoping to keep it client side, with javascript. I have no control over the REST library servers, so I cannot modify any access rights or anything on the servers. (It's kept secure by OAuth).

    My question is: Is it possible to connect with the REST API using only javascript? I'm bound to running into cross domain call problems. Using JSONP is not possible from what I gather, since I would only be able to do GET's and not POST's, right? Also, I don't know a lot about JSONP...does it perhaps require me to make some changes on the API-offering server too?(in which case I can't).

    Is there a way to workaround this problem, or will I be forced to do some serverside programming?