I am creating a customized homepage, which requires me to get data from various sites (for example, the weather).
I have been using the following code:
var req = new XMLHttpRequest()
req.open('GET', 'http://weather.com/en-GB/weather/today/l/...')
req.send()
req.addEventListener('load', function() {
console.log(this.responseText)
})
I also tried req.withCredentials = true
before sending it, but it made no difference.
I found various questions regarding this, however with most of these the users had access to the server. The only one I could find without that was:
Firefox CORS request giving 'Cross-Origin Request Blocked' despite headers
None of the answers said how to get around the problem, so my question is - How can I get around this error?