I am trying to query wolfram to do some math for my site and then display the result. I am having trouble with CORS. My Code:
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
callback(xmlHttp.responseText);
}
xmlHttp.open("GET", "http://api.wolframalpha.com/v2/query?input="+theUrl+"&appid=", true); // true for asynchronous
xmlHttp.send(null);
My Error:
"Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://api.wolframalpha.com/v2/query?input=sqrt(100)&appid=. (Reason: CORS header 'Access-Control-Allow-Origin' missing)."
I understand that on a dynamic site I could just add
Header set Access-Control-Allow-Origin "*"
to .htaccess
but I'm not sure how to do it on a static site. I have read that Allow-Access_origin should already be present in github pages.
2nd answer here: Cross-Origin Resource Sharing on GitHub Pages
2nd answer here: Is there a way to enable CORS on Github pages?