how to Use the Tampermonkey API from the Chrome console

1.Create the following script:

// ==UserScript==
// @name       Exports some GM functions
// @namespace  Whatever
// @match      *
// ==/UserScript==
// WARNING: Any page can now use these methods! Be careful,
// or change "@match *" to "@match https://example.com" and
// visit https://example.com to test the API.
unsafeWindow.GM_xmlhttpRequest = GM_xmlhttpRequest;
unsafeWindow.GM_listValues = GM_listValues;

2.Open any page where Tampermonkey can be activated ( http://stackoverflow.com/ for instance).

3.Open the Developer tools -> Console.

4.Done, you can now do whatever you want with the exported methods (from step 1).

原文地址:https://www.cnblogs.com/ys-wuhan/p/6509643.html