Using data URIs to prompt the user to save files
===

I'm writing a web application which allows a user to select a `PNG` file, write an `iTXt` chunk to it and then save it back to their local file system. I would use the new `FileWriter` API to do so but currently only Google Chrome has added support for it.

Since my file is represented in memory as a [binary string](https://developer.mozilla.org/en/DOM/FileReader#readAsBinaryString() "FileReader - MDN") I use data URIs to prompt the user to save the file as follows:

    window.location.href = "data:application/octet-stream;base64," + btoa(blob);

Since the mime-type is `application/octet-stream` the browser prompts the user to open or save it. However the problem is that the user does not know which type of file it is. So the user has to add the file extension manually.

Currently I alert the user which extension the file needs to be saved with. However this seems like an inelegant solution. Is there a better way to achieve the same result?