Я пытаюсь получить данные из моего фонового скрипта, как рекомендовано здесь , но он всегда блокировался. я что-то пропустил?
Фон. js:
chrome.storage.sync.get(['sigurl'], function(result) {
console.log(result.sigurl);
fetch(result.sigurl)
.then((response) => {
return response.text();
})
.then((html) => {
console.log(html);
chrome.storage.sync.set({'sig': html}, function() {});
})
.catch(function(err) {
console.log('Failed to fetch page: ', err);
});
});
Консоль:
Access to fetch at 'http://example.com/test.html' from origin 'chrome-extension://pbflkjmmkpgddamdcihlbggdccjmjmbk' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
использование режима no-cors также не работало.