tags:

views:

227

answers:

3

Heres the scenario:

  1. User comes to my website and opens a webpage with some javascript functionality.
  2. User edits the data through javascript
  3. User clicks on a save button to save the data, thing is, it seems like they shouldn't need to download this data because its already in javascript on the local machine.

Is it possible to save data from javascript (executing from a foreign webpage) without downloading a file from the server?

Any help would be much appreciated!

+2  A: 

For saving data on the client-side, without any server interaction, the best I've seen is Downloadify, is a small JavaScript + Flash library allows you to generate and save files on the fly, directly in the browser...

Check this demo.

CMS
+2  A: 

JavaScript is run in a sandboxed environment, meaning it only has access to specific browser resources. Specifically, it doesn't have access to the filesystem, or dynamic resources from other domains (web pages, javascript etc). Well, there are other things (I/O, devices), but you get the point.

You will need to post the data to the server which can invoke a file download, or use another technology such as flash, java applets, or silverlight. (i'm not sure about the support for this in the last 2, and I also wouldn't recommend using them, depends what it's for...)

Luke Schafer
A: 

You can save a small amount of data in cookies.

Kinopiko