+
80
-

油猴脚本如何在浏览器中发送跨域请求url?

油猴脚本如何在浏览器中发送跨域请求url?


网友回复

+
0
-

这是我们要引用

// @grant GM_xmlhttpRequest

之后我们的代码中就可以使用GM_xmlhttpRequest函数了

之后我们的代码中就可以使用GM_xmlhttpRequest函数了
// ==UserScript==
// @name         New Userscript
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.bfw.wiki
// @grant        GM_xmlhttpRequest
// @grant        GM_download
// ==/UserScript==
/* jshint -W097 */
'use strict';
GM_xmlhttpRequest({
  method: "GET",
  url: "http://www.qq.com/",
  onload: function(response) {
     //这里写处理函数
  }
});

我知道答案,我要回答