How to save an image to localStorage and display it on the next page?

后端 未结 7 2086
逝去的感伤
逝去的感伤 2020-11-22 07:31

So, basically, I need to upload a single image, save it to localStorage, then display it on the next page.

Currently, I have my HTML file upload:

<         


        
7条回答
  •  太阳男子
    2020-11-22 08:11

    You could serialize the image into a Data URI. There's a tutorial in this blog post. That will produce a string you can store in local storage. Then on the next page, use the data uri as the source of the image.

提交回复
热议问题