Make available as download using JavaScript

I am creating a file in JavaScript. Now I want to make it available to the user, since downloading is possible?

More precisely, this is a KML file that I am creating for its main XML.

0


source to share


1 answer


not. Don't be casual with JavaScript.

What determines that the browser automatically requests to save the file, rather than trying to display it, is its MIME type. And only the server can set the MIME time as it is part of the response header.



Of course, if you are using JS on the server (with Jaxer or another engine) this is another story ...

+1


source







All Articles