Closed ShaCP closed 4 years ago
It works for me using jquery like in the example but I can't get it to work with vanilla js.
var doc; var xhr = new XMLHttpRequest(); xhr.onload = function (event) { console.log(this) console.log(event) } xhr.open("GET", 'http://www.whateverorigin.org/get?url=' + encodeURIComponent('http://google.com')); xhr.responseType = "document"; xhr.send()
What's wrong?
I get
Access to XMLHttpRequest at 'http://www.whateverorigin.org/get?url=http%3A%2F%2Fgoogle.com' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. VM6103:9 GET http://www.whateverorigin.org/get?url=http%3A%2F%2Fgoogle.com net::ERR_FAILED
It works for me using jquery like in the example but I can't get it to work with vanilla js.
What's wrong?
I get
Access to XMLHttpRequest at 'http://www.whateverorigin.org/get?url=http%3A%2F%2Fgoogle.com' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. VM6103:9 GET http://www.whateverorigin.org/get?url=http%3A%2F%2Fgoogle.com net::ERR_FAILED