<tfoot id='34z2I'></tfoot>

<legend id='34z2I'><style id='34z2I'><dir id='34z2I'><q id='34z2I'></q></dir></style></legend>
    <bdo id='34z2I'></bdo><ul id='34z2I'></ul>

  • <i id='34z2I'><tr id='34z2I'><dt id='34z2I'><q id='34z2I'><span id='34z2I'><b id='34z2I'><form id='34z2I'><ins id='34z2I'></ins><ul id='34z2I'></ul><sub id='34z2I'></sub></form><legend id='34z2I'></legend><bdo id='34z2I'><pre id='34z2I'><center id='34z2I'></center></pre></bdo></b><th id='34z2I'></th></span></q></dt></tr></i><div id='34z2I'><tfoot id='34z2I'></tfoot><dl id='34z2I'><fieldset id='34z2I'></fieldset></dl></div>
    1. <small id='34z2I'></small><noframes id='34z2I'>

      1. 如何在更改原点的 chrome-extension 中使用 fetch?

        How can I use fetch in chrome-extension that I change the origin?(如何在更改原点的 chrome-extension 中使用 fetch?)

          <tfoot id='Qom1F'></tfoot>

          1. <i id='Qom1F'><tr id='Qom1F'><dt id='Qom1F'><q id='Qom1F'><span id='Qom1F'><b id='Qom1F'><form id='Qom1F'><ins id='Qom1F'></ins><ul id='Qom1F'></ul><sub id='Qom1F'></sub></form><legend id='Qom1F'></legend><bdo id='Qom1F'><pre id='Qom1F'><center id='Qom1F'></center></pre></bdo></b><th id='Qom1F'></th></span></q></dt></tr></i><div id='Qom1F'><tfoot id='Qom1F'></tfoot><dl id='Qom1F'><fieldset id='Qom1F'></fieldset></dl></div>
            <legend id='Qom1F'><style id='Qom1F'><dir id='Qom1F'><q id='Qom1F'></q></dir></style></legend>

              <small id='Qom1F'></small><noframes id='Qom1F'>

                <tbody id='Qom1F'></tbody>
                • <bdo id='Qom1F'></bdo><ul id='Qom1F'></ul>

                  本文介绍了如何在更改原点的 chrome-extension 中使用 fetch?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  When I use fetch,it gets the request origin like this: Origin: chrome-extension://hhchkohknefpngiknmlkelgmnhokjnef

                  I want the request origin like this: Origin: www.xxxxxx.com (the now website page url)

                  解决方案

                  You can do this using the onBeforeSendHeaders event.

                  chrome.webRequest.onBeforeSendHeaders.addListener(
                      function(details) {
                          for (var i = 0; i < details.requestHeaders.length; ++i) {
                              if (details.requestHeaders[i].name === 'Origin')
                                  details.requestHeaders[i].value = 'https://www.xxxxxx.com';
                          }
                  
                          return {
                              requestHeaders: details.requestHeaders
                          };
                      }, {
                          urls: ["*://www.xxxxxx.com/*"]
                      },
                      ["blocking", "requestHeaders", "extraHeaders"]);
                  

                  extraHeaders option is required for changing changing Origin starting chrome 79.

                  You will need the following permissions in your manifest file:

                  "permissions": [
                      "webRequest",
                      "webRequestBlocking",
                      "*://www.xxxxxx.com/*"
                  ]
                  

                  Reference: https://developer.chrome.com/extensions/webRequest#implementation

                  这篇关于如何在更改原点的 chrome-extension 中使用 fetch?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Fetch multiple links inside foreach loop(在 foreach 循环中获取多个链接)
                  Backbone Fetch Request is OPTIONS method(Backbone Fetch Request 是 OPTIONS 方法)
                  Fetch API leaks memory in Chrome(Fetch API 在 Chrome 中泄漏内存)
                  How can I download and save a file using the Fetch API? (Node.js)(如何使用 Fetch API 下载和保存文件?(Node.js))
                  Send blob data to node using fetch, multer, express(使用 fetch、multer、express 将 blob 数据发送到节点)
                  Sending a custom User-Agent string along with my headers (fetch)(发送自定义用户代理字符串以及我的标头(获取))
                  <i id='XZu0F'><tr id='XZu0F'><dt id='XZu0F'><q id='XZu0F'><span id='XZu0F'><b id='XZu0F'><form id='XZu0F'><ins id='XZu0F'></ins><ul id='XZu0F'></ul><sub id='XZu0F'></sub></form><legend id='XZu0F'></legend><bdo id='XZu0F'><pre id='XZu0F'><center id='XZu0F'></center></pre></bdo></b><th id='XZu0F'></th></span></q></dt></tr></i><div id='XZu0F'><tfoot id='XZu0F'></tfoot><dl id='XZu0F'><fieldset id='XZu0F'></fieldset></dl></div>
                    <bdo id='XZu0F'></bdo><ul id='XZu0F'></ul>
                        <tbody id='XZu0F'></tbody>

                        <small id='XZu0F'></small><noframes id='XZu0F'>

                        <legend id='XZu0F'><style id='XZu0F'><dir id='XZu0F'><q id='XZu0F'></q></dir></style></legend>
                        <tfoot id='XZu0F'></tfoot>