V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
XhstormR
V2EX  ›  问与答

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

  •  
  •   XhstormR · 2016-12-13 09:59:04 +08:00 · 6431 次点击
    这是一个创建于 2703 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    从 63 行开始至 137 行结束。

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

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

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

    XhstormR
        7
    XhstormR  
    OP
       2016-12-13 15:01:45 +08:00   ❤️ 1
    Khlieb
        8
    Khlieb  
       2016-12-13 22:09:05 +08:00 via Android
    NoScript 可行否
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   6042 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 03:23 · PVG 11:23 · LAX 20:23 · JFK 23:23
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.