如何在 Tampermonkey 脚本中包含本地 html 页面?

How to include Local htm pages in a Tampermonkey script?

下面的脚本可以在普通网页上运行,但我如何才能让它在 本地 .htm 文件 上也运行? (在 Chrome 浏览器中打开时)

// ==UserScript==
// @name            betterTwitter
// @version         0.5
// @namespace       http://www.h4xful.net/
// @description     Gets rid of the garbage on Twitter's side-panel.
// @include         http://twitter.com/*
// @include         https://twitter.com/*
// @include         file://C:/Users/*.htm
... ... 

最后一行 (@include file:...) 根本不起作用。该脚本不会针对示例页面触发。

首先,在 Chrome 的扩展设置页面 (chrome://extensions/) 上,确保 Tampermonkey 可以访问文件 URL:

其次,使用正确数量的斜杠格式化 @include(或 @match)。它应该几乎总是以 file:///.
开头 例如:

// @include    file:///C:/Users/*.htm