关于脚本猫GM_cookie的问题
`// ==UserScript==// @name demo1
// @namespace https://www.csdn.net/
// @version 0.1.0
// @descriptiontry to take over the world!
// @author You
// @connect www.csdn.net
// @match https://www.csdn.net/*
// @grant unsafewindow
// @grant GM_info
// @grant GM_xmlhttpRequest
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_setClipboard
// @grant GM_download
// @grant GM_openInTab
// @grant GM_listValues
// @grant GM_cookie
// ==/UserScript==
(function() {
'use strict';
// Your code here...
unsafeWindow.GM_info=GM_info;
unsafeWindow.GM_xmlhttpRequest=GM_xmlhttpRequest;
unsafeWindow.GM_setValue=GM_setValue;
unsafeWindow.GM_getValue=GM_getValue;
unsafeWindow.GM_openInTab=GM_openInTab;
unsafeWindow.GM_download=GM_download;
unsafeWindow.GM_openInTab=GM_openInTab;
unsafeWindow.GM_listValues=GM_listValues;
unsafeWindow.GM_cookie_=GM_cookie;
GM_cookie("list", {
domain: window.location.host
}, (cookies) => {
console.log("domain", cookies);
});
})();`
代码如上
打开网页后会输出cookie信息
![微信截图_20231022231115.png](data/attachment/forum/202310/22/231347ytutblswzo8l88wx.png)
api函数好像也能显示出来
![微信截图_20231022231154.png](data/attachment/forum/202310/22/231437mcw530usmmctb4wm.png)
但是为什么复制这个输出的代码不能运行??
![微信截图_20231022231230.png](data/attachment/forum/202310/22/231517z7jujk3plljpptpx.png) unsafeWindow.GM_cookie_=GM_cookie;
GM_cookie_ 多了个_? 王一之 发表于 2023-10-23 01:31
unsafeWindow.GM_cookie_=GM_cookie;
GM_cookie_ 多了个_?
{:4_88:}我的天,没注意看。。。囧,解决了,另外老大我想问下,我取到这个list去赋值到gm_xmlhttprequest里面的cookie,去做请求就可以是不是? ray040237 发表于 2023-10-23 09:43
我的天,没注意看。。。囧,解决了,另外老大我想问下,我取到这个list去赋值到gm_xmlhttprequest里面 ...
没必要gm_xmlhttprequest会自动携带cookie的
页:
[1]