WCF webHttpBinding with jQuery AJAX - removing/working around same origin policy

Posted by csauve on Stack Overflow See other posts from Stack Overflow or by csauve
Published on 2010-06-09T21:19:06Z Indexed on 2010/06/09 21:22 UTC
Read the original article Hit count: 246

Filed under:
|
|
|
|

So I'm trying to create a C# WCF REST service that is called by jQuery. I've discovered that jQuery requires that AJAX calls are made under the same origin policy. I have a few questions for how I might proceed.

I am already aware of; 1. The hacky solution of JSONP with a server callback 2. The way too much server overhead of having a cross-domain proxy. 3. Using Flash in the browser to make the call and setting up crossdomain.xml at my WCF server root.

I'd rather not use these because; 1. I don't want to use JSON, or at least I don't want to be restricted to using it 2. I would like to separate the server that serves static pages from the one that serves application state. 3. Flash in this day in age is out of the question.

What I'm thinking: is there anything like Flash's crossdomain.xml file that works for jQuery? Is this "same-origin" policy a part of jQuery or is it a restriction in specific browsers? If it's just a part of jQuery, maybe I'll try digging in the code to work around it.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery