How do I inject certain files into certain websites from a chrome extension

后端 未结 2 2024
醉酒成梦
醉酒成梦 2021-01-15 19:56

In my chrome extension I have multiple files that inject script into websites, I want to know how I can inject 1 file for a certain website. To better explain

My chr

2条回答
  •  礼貌的吻别
    2021-01-15 20:33

    Use the Tampermonkey / Greasemonkey extensions, with the header like that:

    // ==UserScript==
    // @name         MTV Statistical Data For Tampermonkey & Greasemonkey
    // @namespace    MTV_statistical_data
    // @include     /^https?://(www\.)?mytrafficvalue\.com/shareholders\.html(\#marketplace)?$/
    // @author       facebook.com/igor39
    // @version      7.5
    // @grant        none
    // @description  Improving the user experience & provide more of statistics on the page www.mytrafficvalue.com/shareholders.html
    // ==/UserScript==
    

    Example: http://pastebin.com/Z4zq2h6Q

提交回复
热议问题