Intercept an HTTP request at browser end to alter some html content

后端 未结 11 1838
灰色年华
灰色年华 2021-02-06 19:43

I would like to do as follows. What would be the best way? A general answer will also be fine.

I would like to intercept an HTTP request at the client end to alter some

11条回答
  •  温柔的废话
    2021-02-06 20:11

    You can do this with Privoxy via their filter files. Their fun filter is a good example of exactly the sort of substitutions you want to do.

    To replace "Two LA Dogs Marry" with "Ridiculous Title Blocked" on cnn.com your action file would look something like this:

    { +filter{ridiculous-title-censor} }  
    .cnn.com
    

    and your filter file would look like

    # FILTER: ridiculous-title-censor Remove ridiculous titles
    # This keeps CNN from getting too ridiculous
    #
    s/Two LA Dogs Marry/Ridiculous Title Blocked/ig
    

提交回复
热议问题