• 请不要在回答技术问题时复制粘贴 AI 生成的内容
siwadiya
V2EX  ›  程序员

quanX 能屏蔽 js 执行吗

  •  
  •   siwadiya · Oct 25, 2021 · 2463 views
    This topic created in 1661 days ago, the information mentioned may be changed or developed.

    知道 url 和 js 的名称,但是不能屏蔽这个 url ,只想屏蔽部分 js 执行

    4 replies    2021-10-25 11:40:22 +08:00
    kingwkb
        1
    kingwkb  
       Oct 25, 2021
    不能,好像可以替换
    lisongeee
        2
    lisongeee  
       Oct 25, 2021
    只想屏蔽部分 js 执行?是指哪部分?
    某个函数吗?那你可以用 babel 解析 js 代码得到 ast ,然后修改 ast ,再转化为 js 代码 即可
    siwadiya
        3
    siwadiya  
    OP
       Oct 25, 2021
    @lisongeee 通过 script 引入的 js 文件,想像 reject url 那样屏蔽这个文件,或者不让它执行。
    lisongeee
        4
    lisongeee  
       Oct 25, 2021
    @siwadiya 那其实不用完全屏蔽这个 js 文件,拦截它的 HTTP 报文然后把报文的 body 修改为空字符串或者无作用函数即可
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1073 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 22:54 · PVG 06:54 · LAX 15:54 · JFK 18:54
    ♥ Do have faith in what you're doing.