allow CORS on server side examples

allow CORS on server side examples

ctaggartctaggart Posts: 2Questions: 0Answers: 0
edited January 2013 in Feature requests
When playing around with the server side examples locally, it would be very convenient if the service side data service examples support CORS.
It looks like it may simply be a one line change to enable. <?php header("Access-Control-Allow-Origin: *");

With it enabled, this should work from a local file:

type: 'GET',
dataType: 'json',
contentType: 'application/json; charset=utf-8',
url: ''

In the meanwhile, it is possible to load Chrome with same origin policy disabled, but is not a great workaround.


  • allanallan Posts: 57,686Questions: 1Answers: 9,195 Site admin
    Some of the examples have JSONP support which you could use:

    I'm not overly keen on opening more resources on this little server - its already getting a hammering! :-). Indeed I was actually thinking of ways to reduce the server being (incorrectly) used as a CDN by many. But certainly something I'll keep in mind for future as I can see it would be useful for testing.

  • ctaggartctaggart Posts: 2Questions: 0Answers: 0
    May be just allowing an Origin of null for local files would work. I just posted a blog about using DataTables from TypeScript and added some details to this issue.
This discussion has been closed.