I'm hosting some JSON files on Github pages, but I am unable to use $.getJSON
to retrieve them unless they come from the exact same domain.
Is there a way to enable CORS for Github pages?
CORS is essentially controlled by the Access-Control-Allow-Origin (ACAO) header on server, and nothing you do on the client can bypass this restriction.
Two methods: Install a chrome extension to Access-control-allow-origin to allow cross-origin redirects. extention will allow if your backend server is on your local machine.
Github Pages now has CORS enabled.
The CORS header:
Access-Control-Allow-Origin: *
Is added by default on all responses from Github pages!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With