google-chromegoogle-chrome-devtoolscode-snippets

Which file does Snippets of Chrome Dev Tool saved at?


As I know , personal data always be saved at profile path which can be find at chrome://version.

I added many snippets in my Chrome Dev Tool, and want to backup them .

But I cann't find a file that snippets data saved in under this path.

Does anyone knows ? Plz tell me . Thanks very much!


Solution

  • As of Chrome 47 (or so), snippets are no longer available via localStorage. Also, natchiketa's answer is dependent on localStorage and also doesn't work any longer.

    Below is the current technique:

    getting snippets

    InspectorFrontendHost.getPreferences(_ => console.log(JSON.parse(_.scriptSnippets)))
    

    setting snippets

    InspectorFrontendHost.setPreference("scriptSnippets", JSON.stringify(yourSnippets))
    

    This technique was extracted from a github thread discussing this change.