I have the contents of a file in a Javascript variable. When the user clicks something (link, button, etc.) I want the "save as" dialog to appear with a filename specified by my code and when the user clicks "save", the contents of the Javascript variable are saved in the file.
I know how to do this using server-side code but that is not an option for this application.
I've seen several conversations on StackOverflow related to this issue and the difficulties surrounding it so I'm placing a bounty on this one to encourage creative thinking :)