-1

I tried to use that

function httpGet(theUrl) {
  var xmlHttp = new XMLHttpRequest();
  xmlHttp.open("GET", theUrl, true); 
  xmlHttp.send(null);
  return xmlHttp.responseText;
}

console.log(httpGet("https://www.youtube.com"))

but it's say

Access to XMLHttpRequest at 'https://www.youtube.com/' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

GET https://www.youtube.com/ net::ERR_FAILED 200

0 Answers0