XhstormR
V2EX  ›  问与答

如何禁用掉百度云的 Javascript 跳转代码?

  •  
  •   XhstormR · Dec 13, 2016 · 7270 views
    This topic created in 3611 days ago, the information mentioned may be changed or developed.

    链接:view-source:https://pan.baidu.com/wap/home

    从 63 行开始至 137 行结束。

    主要用了 if (navigator.platform.match(/win32|mac/i)) 判断系统平台。

    就像伪装 user agent 一样,有什么办法可以伪装系统平台吗?或者直接禁用掉此行代码?

    8 replies  •  2016-12-13 22:09:05 +08:00
    hansnow
    hansnow
    Dec 13, 2016
    1
    Object.defineProperty(this , 'navigator' , {value: { platform: "" }});
    GPU
    GPU
    Dec 13, 2016
    2
    @hansnow 我今天早上看到这段代码是在草榴 , 中午在这里又看到一次.
    foo2bar
    foo2bar
    Dec 13, 2016
    3
    @GPU 说明了两个老司机发生了撞车
    ahillgian
    ahillgian
    Dec 13, 2016
    5
    已失效? 提示:
    VM191:1 Uncaught TypeError: Cannot redefine property: navigator
    at Function.defineProperty (<anonymous>)
    at <anonymous>:1:8
    (anonymous) @ VM191:1
    yejinmo
    yejinmo
    Dec 13, 2016
    6
    navigator 已经被禁用了吧。。

    Khlieb
    Khlieb
    Dec 13, 2016 via Android
    8
    NoScript 可行否
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1749 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 271ms · UTC 23:46 · PVG 07:46 · LAX 15:46 · JFK 18:46
    ♥ Do have faith in what you're doing.