export Data in localStorage for later re-import

后端 未结 5 667
既然无缘
既然无缘 2021-01-31 00:22

I want to export a few items from my localStorage to save it externally but in a format so that I can import it again later.

My attempt was to write executable code that

5条回答
  •  闹比i
    闹比i (楼主)
    2021-01-31 00:49

    Just an improved version of Jeremy. To simplify the process

    copy('var data = '+JSON.stringify(localStorage)+';Object.keys(data).forEach(function (k){localStorage.setItem(k, data[k]);});');
    

    Run this in console where you need to export, it copies localstorage content along with code to clipboard and just paste it in the console where you want to import.

提交回复
热议问题