-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
Forgive me if this has been covered before, but I'm having an issue utilizing JSONP to make cross-domain ajax calls.
The jquery-win8 library is working very well for just about everything else, though. If an ajax call uses 'jsonp' the call is made within a WinRT application, the typical "An app can’t load remote web content in the local context." error is generated.
For example:
$.ajax({
url: "http://external_server.com/api_endpoint",
dataType: 'jsonp',
contentType: "application/json; charset=utf-8",
data: {message: "some_message"},
success: function(rdata){
console.log("success!");
},
error: function(edata){
console.log("ERROR:" + edata.status + ", " + edata.statusText);
}
});
I have come up with a workaround, using an IFRAME executing in the web context (url protocol of "ms-appx-web:"), and then using .postMessage
to tunnel back and forth, with the IFRAME script making the actual JSONP call above. But this seems like a lot of work and will incur some performance penalties for the indirection.
Question(s):
- Is JSONP ever going to be natively supported by this library?
- If not, (or if it will take a while) are there any other approaches to supporting cross-domain ajax that we can take?
- Is the IFRAME Tunneling approach unsound? Is there a possibility of MS shutting that down in the future?
Metadata
Metadata
Assignees
Labels
No labels