4

I'm writing a service (say, service.com) that provides a REST API to external apps running inside of IFrames. (These apps are hosted from domains outside the service.com).

I'm planning a javascript client library for the apps to make pure-javascript requests to the service.com REST API -- basically using postMessage and some ad-hoc encapsulation of my API calls to get messages back and forth across frames (from the outside-app.com IFrame --> service.com REST API, and back to the IFrame with a response).

My question: is there any robust, general-purpose javascript library to accomplish the kind of cross-domain REST request proxying I need, or should I just hack it from scratch?

1 Answer 1

3

Have you heard about origin access control? You can just set it in your .htaccess to allow XHR requests across domains.

Header Set Access-Control-Allow-Origin *

In which case, you don't need anything past your standard AJAX components.

1
  • what is .htaccess and how can I set it? Can u explain it? Feb 18, 2013 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.