ripper234 / Whatever-Origin

An open source alternative to AnyOrigin.com (this project is looking for a maintainer)
http://whateverorigin.org/
321 stars 74 forks source link

Not working with xmlhttprequest #29

Closed ShaCP closed 4 years ago

ShaCP commented 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