Save canvas to an image file dynamically

192 views Asked by At

Is there a way to download a canvas image to a file folder without a prompt showing up? I have found solutions requiring a prompt where you name the file, but I have not found any solutions where you can dynamically name the image and save to a local file. I am very new to front-end development, so I am not entirely familiar with Node.js or JQuery/PHP/Ajax. I have found solutions using these but they have ended up still using prompts.

1

There are 1 answers

2
Deian On

In general, this is a security feature.

You don't want a site you browsing to save files to your computer silently. They can possibly contain a malicious code for example, or override an existing file. Thus, as a security feature the browsers are asking you to name the file you will save.

There is a way to name the files thou, so you don't need to present the user with generic file name.

On How to do that - it really depends what are you using to do it..

In your situation - if those are log files you want to save - you can send them back to the server. That can be easily done.