JWilling
V2EX  ›  问与答

如何使用原生 Chrome 开发者工具批量替换修改网页内容?

  •  
  •   JWilling · Sep 19, 2019 via Android · 4869 views
    This topic created in 2443 days ago, the information mentioned may be changed or developed.

    例子如:

        网页上有大量文本为“baidu”,我想把所有的“baidu”替换成“taobao”。
    

    网页必须为在线实时网页,不能保存本地再替换。

    5 replies    2019-09-20 16:34:59 +08:00
    AreYou0k
        1
    AreYou0k  
       Sep 19, 2019
    chrome 插件, 油猴脚本
    JWilling
        2
    JWilling  
    OP
       Sep 19, 2019 via Android
    @AreYou0k 使用原生 Chrome 开发者工具不可以吗
    xxx749
        3
    xxx749  
       Sep 19, 2019   ❤️ 1
    $$('*').forEach(el => el.innerHTML = el.innerHTML.replace(/baidu/gi, 'taobao'))
    airyland
        4
    airyland  
       Sep 19, 2019   ❤️ 1
    document.body.innerHTML = document.body.innerHTML.replace(/baidu/g, 'taobao')
    JWilling
        5
    JWilling  
    OP
       Sep 20, 2019
    @xxx749
    @airyland
    非常感谢两位!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1295 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 17:16 · PVG 01:16 · LAX 10:16 · JFK 13:16
    ♥ Do have faith in what you're doing.