Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No support for cross-domain JSONP? #11

Open
jifka opened this issue Mar 14, 2013 · 0 comments
Open

No support for cross-domain JSONP? #11

jifka opened this issue Mar 14, 2013 · 0 comments

Comments

@jifka
Copy link

jifka commented Mar 14, 2013

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?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant