How is it done, of course without external libraries, in regular HTML with JavaScript? This seems like it should be a simple one-liner.
I'd like to just do:
<script>
localStorage.image=src("http://"+randomflikrimage+".jpg")
</script>
As we established above, localStorage only supports strings, so what we need to do here is turn the image into a Data URL. One way to do this for an image, is to load into a canvas element. Then, with a canvas , you can read out the current visual representation in a canvas as a Data URL.
Only string values can be stored in local storage - this will not be a problem, and we'll see in this post how we'll store a collection of images along with some data for each.
Try storing base64 data, use canvas. Check this: Get image data in JavaScript?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With