title: 'Access to fetch has been blocked by CORS policy' Chrome extension error
body: <p>I am trying to get data from an external API from the background script of my Chrome extension, using messaging to initiate the call from the content script and get the results. I have no control over the external API. The documentation from that API says to use script tags to get a jsonp response, but if I understand correctly, that shouldn't matter when the below items are implemented. Am I wrong?</p>
  <ul>
  <li>the <code>fetch()</code> is in the background script</li>
  <li><code>&quot;\*://\*/&quot;</code> is in my permissions in the manifest (I will change that if I can get this to work, just eliminating that possibility)</li>
  <li>The extension is 'packed'</li>
  </ul>
  <blockquote>
  <p>Error:
  Access to fetch at 'https://external-api.com' from origin 'chrome-extension://bunchofchars' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: 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.</p>
  </blockquote>
  <p>Any clue as to what I'm doing wrong?</p>
  <p>background.js</p>
  <pre><code>chrome.runtime.onMessage.addListener(
    function(request, sender, sendResponse) {
        fetch('https://api.com/' + request.user + 'restofurl',
            {
              method: 'get',
              headers: {'Content-Type':'application/json'}
            })
  //          .then(response =&gt; parseResults(response.results))
            .then(response =&gt; sendResponse({result: response.results}))
  //          .catch(error =&gt; ...)
        return true;
    });
  </code></pre>
  <p>content.js</p>
  <pre><code>(() =&gt; {
      function foo() {
  
          var parent = document.getElementById('someId');
          var username = parent.getElementsByTagName('a')[6].innerHTML;
          chrome.runtime.sendMessage({user: username}, function(response) {
              console.log(response.result);
          });
      window.addEventListener('load', foo);
  
  })();
  </code></pre>