How override eval function in javascript?

前端 未结 6 1686
滥情空心
滥情空心 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:36

    I tried this in FireFox 3.6.2 and it appears to work.

    I typed this directly in the FireBug command line:

    var proxied = eval;
    eval = function() { alert("ha"); return proxied.apply(this, arguments);};
    eval(7);
    

提交回复
热议问题