Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google chrome extension 如何使用MIME类型text/html、Chrome扩展73修复CORB_Google Chrome Extension - Fatal编程技术网

Google chrome extension 如何使用MIME类型text/html、Chrome扩展73修复CORB

Google chrome extension 如何使用MIME类型text/html、Chrome扩展73修复CORB,google-chrome-extension,Google Chrome Extension,将代码从myscript.js传递到background.js的正确方法是什么 我有 myscript.js function fox2(){ { var url = 'https://sub.domain.com' var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.onreadystatechange = function() { if (xhr.ready

将代码从myscript.js传递到background.js的正确方法是什么

我有

myscript.js

function fox2(){
{
    var url = 'https://sub.domain.com'
      var xhr = new XMLHttpRequest();
      xhr.open('GET', url, true);
      xhr.onreadystatechange = function() {
        if (xhr.readyState == 4) {
          var parser = new DOMParser();
          source_code = parser.parseFromString(xhr.responseText, "text/html");   
          var a = source_code;
          console.log(a)
        }
      };
      xhr.send();
    }
     }
fox2();
Background.js

chrome.browserAction.onClicked.addListener(function(tab) {
 chrome.tabs.executeScript(null, {file: "nuevo.js"});
});
错误:跨源读取阻止(CORB)使用MIME类型text/html阻止跨源响应

我知道解决办法是在后台使用代码,但我应该怎么做呢

谢谢