I am creating a webpage with javascript that is doing some processing and building a data file in a variable. At the end of the processing, I want to provide a link that will let the user right click a link and do save as or something similar to save the results of that variable. Is there a way to do this without posting the results back to the server and writing out the file to the server and then redirecting to another page with the link. Basically I want to be able to provide the user with a way to do a save as or click a link to open the contents of a variable in javascript. I am thinking maybe an iframe and put the contents there?
I am creating a webpage with javascript that is doing some processing and building
Share
You might be able to use a
data://URL for that, at least on some browsers.Alternately, yeah, have the link open a new window and write the contents there. They can then “save as” the new page (live example):