How to trigger a Chrome extension, content-script for a given hash in the URL?

后端 未结 1 629
灰色年华
灰色年华 2020-12-02 00:17

My matches scheme:

\"content_scripts\" : [
 {
   \"matches\" : [
     \"https://stackoverflow.com/questions#epic*\"
   ],
   \"js\" : [\"silly.js\"]
 }
],


        
相关标签:
1条回答
  • 2020-12-02 00:41

    See Content scripts, Match Patterns.
    Match patterns do not operate on the fragment portion of a URL.

    To restrict a content script to a given hash, use the include_globs and/or exclude_globs properties.

    For example, in this case you might use:

    "content_scripts" :     [ {
        "matches" :         [
            "*://stackoverflow.com/questions/*"
        ],
        "include_globs" :   ["*#epic*"],
        "js" :              ["silly.js"]
    } ],
    
    0 讨论(0)
提交回复
热议问题