How to get input from Chrome's Javascript console?

前端 未结 6 761
情话喂你
情话喂你 2020-12-29 06:21

Is there a way to programmatically get input from the Javascript Console of Google Chrome, similar to readline() in Firefox?

6条回答
  •  旧时难觅i
    2020-12-29 07:25

    We can do is hook the console.log so whenever it logs something we can access, otherwise there is no such direct method as like in firefox which does this possible for us in a simple single line code.

    var tempStore = [];
    var oldLog = console.log;
    
    console.log = function() {
        tempStore.push(arguments);
        oldLog.apply(console, arguments);
    }
    

提交回复
热议问题