Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

后台脚本 xhr 加载blob 进不了onload #34

Closed
ChitaGideon opened this issue Jan 29, 2022 · 1 comment
Closed

后台脚本 xhr 加载blob 进不了onload #34

ChitaGideon opened this issue Jan 29, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@ChitaGideon
Copy link

// ==UserScript==
// @name         New Userscript2222
// @namespace    https://bbs.tampermonkey.net.cn/
// @version      0.1.0
// @description  try to take over the world!
// @author       You
// @crontab      * * once * *
// @grant        GM_log
// @grant    GM.xmlHttpRequest
// @grant        GM_xmlhttpRequest
// @connect baidu.com
// @connect httpbin.org
// ==/UserScript==
console.log = (...arg) => {
    GM_log(arg.map(it => typeof it == 'string' ? it : JSON.stringify(it)).join(","))
}

return new Promise((resolve, reject) => {
    // Your code here...
    // downloadImg('http://httpbin.org/image/jpeg').then(resolve);
    GM.xmlHttpRequest(
        {
            method: 'GET',
            url: 'http://httpbin.org/image/jpeg',
            // headers: { 'Content-Type': 'text/xml', "Accept": "text/xml" },
            responseType: "blob",
            // data: xmlstring,
            onload: function (response) { console.log('load');resolve() },
            onreadystatechange: function (response) { console.log('statechange', response) },
        }
    )
});

页面能进onload, 后台就进不了

@CodFrm CodFrm added the bug Something isn't working label Jan 29, 2022
@CodFrm
Copy link
Member

CodFrm commented Feb 1, 2022

新年快乐,处理了,感谢反馈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants