Tampermonkey:@match URL 中的标签

问题描述

我有这个链接,我想在其上运行用户脚本:
https://someurl.somewhere.com/#/some/create-on

@match https://someurl.somewhere.com/#/some/create-on 不起作用。

我认为这可能是主题标签,但我真的不知道..我认为这是一个解决方案,但它不起作用:
@match https://someurl.somewhere.com/*/some/create-on

我需要帮助。用户脚本在 tampermonkey ofc 中。

解决方法

URL 中的

# 被视为 Location: hash,因此在您的示例中:

  • 主网址:https://someurl.somewhere.com/
  • 位置哈希:#/some/create-on

用户脚本应与主 URL 匹配,例如

@match       https://someurl.somewhere.com/

或者如果有未知的 Location: pathname ...

@match       https://someurl.somewhere.com/*