Save / export Chrome's JavaScript console input history

后端 未结 1 822
北荒
北荒 2021-02-09 05:51

Is there anyway that I can save or export the history of JavaScript console input (console history) in Google Chrome? I\'m not looking to save the output or the errors,

相关标签:
1条回答
  • 2021-02-09 06:05

    I figured out a weird solution that seems to work:

    • Open Chrome Developer Tools (press CTRL + SHIFT + J)

    • If the developer tools window is docked, undock into a separate window (open the menu to choose docking option)

    • Inside the developer tools window, press CTRL + SHIFT + J which will open a developer tools window for the developer tools window!

    • Inside the second developer tools window, enter the following command inside console:
      localStorage.getItem("consoleHistory")

    This should print the console history, encoded as JSON inside the console. You can decode the JSON into an array using this command:

    JSON.parse(localStorage.getItem("consoleHistory"))
    

    Or copy the JSON to clipboard using:

    copy(localStorage.getItem("consoleHistory"))
    
    0 讨论(0)
提交回复
热议问题