I am trying to get a page's HTML using fetch API. Here is my code.
var quizUrl = 'http://www.lipsum.com/';
var myHeaders = new Headers();
myHeaders.append('Content-Type', 'text/html');
fetch(quizUrl,{
mode: 'no-cors',
method: 'get',
headers: myHeaders
}).then(function(response) {
response.text().then(function(text) {
console.log(text);
})
}).catch(function(err) {
console.log(err)
});
It returns empty string. Any guesses why it doesn't work?
question from:https://stackoverflow.com/questions/41921805/fetch-api-returning-an-empty-string