My current challenge involves fetching the HTML content of a website using AngularJS
. Below is the snippet of code I am working with:
$http({method: 'GET', url: "http://www.google.com",
headers:{
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type, X-Requested-With'
}})
.success(function(d){ console.log( "yay" ); })
.error(function(d){ console.log( "nope" ); });
The issue I'm encountering is the dreaded CORS
error:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
While I am well-versed in the complexities of the CORS
problem and understand that it primarily pertains to server configurations, I would greatly appreciate any suggestions or potential solutions to help resolve my dilemma.