Novice level - do DataURLs automatically save to a specific location?

67 Views Asked by At

I am a complete novice, doing some work on a HTML5 drag and drop game. I am looking at coding tutorials which will save an image of the game when the user presses a button. The canvas image is saved as a DataURL. I kind of understand what this means. But my questions are: where does the image save to (as you don't seem to need to specify a location) & will an image saved to that location always have a unique URL (i.e. images saved from different games wont overwrite).

1

There are 1 best solutions below

0
On

The Data Url is just a Base64 encoded string which represents an image. I'm not sure about your exact implementation, but you almost always would have to save that string at some persistent location. Try the Local Storage for instance if you want to save the image on the user's machine and not on a server.

Otherwise, you can always POST the Base64 encoded string via Ajax to your own server and save it in a file or database.