Javascript 有没有办法让greasemonkey或tampermonkey重新启动浏览器?

Javascript 有没有办法让greasemonkey或tampermonkey重新启动浏览器?,javascript,greasemonkey,tampermonkey,Javascript,Greasemonkey,Tampermonkey,有没有办法让tampermonkey或greasemonkey重新启动浏览器?只需清除所有cookie,而不是重新启动即可清除cookie编辑您的Chrome快捷方式(或在Linux/MacOS中编写shell脚本)并添加 (或使用随机端口号),以便发送RDP命令: // ==UserScript== // @name Clear cookies // @match https://www.example.org/* // @grant GM_xmlhttp

有没有办法让tampermonkey或greasemonkey重新启动浏览器?只需清除所有cookie,而不是重新启动即可

清除cookie编辑您的Chrome快捷方式(或在Linux/MacOS中编写shell脚本)并添加

(或使用随机端口号),以便发送RDP命令:

// ==UserScript==
// @name        Clear cookies
// @match       https://www.example.org/*
// @grant       GM_xmlhttpRequest
// @connect     localhost
// ==/UserScript==

GM_xmlhttpRequest({
  url: 'http://localhost:1234/json',
  responseType: 'json',
  method: 'GET',
  onload(e) {
    const ws = new WebSocket(e.response[0].webSocketDebuggerUrl);
    ws.onopen = () => {
      ws.send(JSON.stringify({id: 1, method: 'Network.clearBrowserCookies'}));
    };
    ws.onerror = console.warn;
  },
});

这回答了你的问题吗?谢谢,这正是我要找的@Kilrobot如果您发现这是答案,只需单击此答案左侧的“绿色复选图标”即可将其作为正确答案接受。
// ==UserScript==
// @name        Clear cookies
// @match       https://www.example.org/*
// @grant       GM_xmlhttpRequest
// @connect     localhost
// ==/UserScript==

GM_xmlhttpRequest({
  url: 'http://localhost:1234/json',
  responseType: 'json',
  method: 'GET',
  onload(e) {
    const ws = new WebSocket(e.response[0].webSocketDebuggerUrl);
    ws.onopen = () => {
      ws.send(JSON.stringify({id: 1, method: 'Network.clearBrowserCookies'}));
    };
    ws.onerror = console.warn;
  },
});