在Chrome控制台中使用Tampermonkey API? [英] Use the Tampermonkey API from the Chrome console?
本文介绍了在Chrome控制台中使用Tampermonkey API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有任何方式在Chrome的JavaScript中使用 Tampermonkey的API 安慰?
Is there any way use Tampermonkey's API in Chrome's JavaScript console?
我想使用 GM_xmlhttpRequest()
和 GM_listValues code>。
I want to mess with functions like GM_xmlhttpRequest()
and GM_listValues()
.
推荐答案
-
创建以下脚本:
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;
Open any page where Tampermonkey can be activated ( http://stackoverflow.com/ for instance).
这篇关于在Chrome控制台中使用Tampermonkey API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文