有没有办法使用Tampermonkey's API在 Chrome 的 JavaScript 控制台?
我想搞乱像 GM_xmlhttpRequest()
和 GM_listValues()
这样的函数。
最佳答案
创建以下脚本:
// ==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;
打开任何可以激活 Tampermonkey 的页面(例如 https://stackoverflow.com/)。
- 打开开发者工具 -> 控制台。
- 完成,您现在可以使用导出的方法(从第 1 步开始)做任何您想做的事情。
关于javascript - 从 Chrome 控制台使用 Tampermonkey API?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14059078/