How override eval function in javascript?

前端 未结 6 1684
滥情空心
滥情空心 2021-01-17 19:00

For example:

(function() {
      var proxied = window.eval;
      window.eval = function() {
        return proxied.apply(this, arguments);
      };
    })()         


        
6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-17 19:46

    Not only should you not do this, but I also think you probably can't. First, eval is a global function, and as such is not a member of window (as you tried above). Secondly as a global function it is highly likely that it is hard-wired into the VM and can't be overwritten.

提交回复
热议问题