Skip to content

API 参考

扩展 API 的汇总参考。状态图例:

  • 可用 —— 按预期工作。
  • 🟡 部分 —— 可用但有注意事项(见说明)。
  • —— 存在但返回默认值 / no-op。

油猴脚本 GM_*

API状态说明
GM_getValue / GM_setValue / GM_deleteValue / GM_listValuesSharedPreferences 支撑,按脚本命名空间
GM_xmlhttpRequest经 OkHttp;完整回调集
GM_addStyle
GM_setClipboard
GM_openInTab
GM_log
GM_getResourceText / GM_getResourceURL
GM_registerMenuCommand / GM_unregisterMenuCommand浮窗菜单
GM_openScriptWindow / GM_updateScriptWindow / GM_closeScriptWindowWebToApp 专属
GM_info
unsafeWindow等于 window(无沙箱)
GM_notification🟡仅记录日志;无系统通知
@grant 门控无论声明的 grant,所有 API 都暴露
GM.*(Promise)镜像上述全部

Chrome chrome.*

命名空间状态说明
runtime消息、生命周期、getURLgetManifest
storagelocal/sync/session;managed no-op
tabs核心增删改查 + 事件
scripting动态 content script 注册
cookies
alarms
declarativeNetRequestblock/allow/redirect/modifyHeaders/upgradeScheme
downloads🟡download 可用
webRequest🟡onBeforeRequest 经原生桥过滤
i18n / notifications / permissions / contextMenus / commands
webNavigation / extension / idle / tabGroups🟡
action / sidePanel🟡
windows / management / topSites / fontSettings
identity / history / proxy / privacy
system.cpu/memory/display/storage
bookmarks / offscreen / tts
browserAction / pageAction(MV2)🟡兼容别名

本表是活文档

可用/桩状态正在逐项核实。有疑问时,请以当前构建实测为准。

Released under the Unlicense.