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?
Have you heard about origin access control? You can just set it in your .htaccess to allow XHR requests across domains.
In which case, you don’t need anything past your standard AJAX components.