title: Saving data to a local file using only JavaScript
body: <p>The set-up in question:</p>
  
  <p>I have a stand alone, <strong>offline</strong>, kiosk mode instance of Chrome running on a Windows machine. I have full access to the system and any admin rights. I can start Chrome with any flags set or unset.</p>
  
  <p>The task:</p>
  
  <p>I have been asked to create a log file which tracks user activity within the <strong>offline</strong> app I am coding. It's a simple form of analytics which will append each event to the end of the file separated with a comma. The file will then be sent to a server once a day via a scheduled task. (None of this is my idea so please don't troll me)</p>
  
  <p>Ruled out:
  <strong>Any server side code</strong> - I have lobbied for Node, PHP etc but as this will be distributed to many different installations so we cannot guarantee this will be installed.
  Flash/ActiveX/Java - ideally would like to avoid this (even though these will be installed by default)</p>
  
  <p>Possible solutions:
  File API - I have looked at this but <em>AFAIK</em> if opens dialogue boxes to save the data to each file and this needs to happen in the background.
  Security - I have read in other SO Questions that this can be achieved if the security settings are reduced but no-one goes on to explain which ones. Is there a simple flag which allows it?
  <a href="https://stackoverflow.com/questions/12257109/how-to-enable-local-file-system-read-write-access-from-google-chrome">How to enable local file system read write access from Google chrome?</a> - similar question!</p>
  
  <p>Ideal result: (something akin to PHP)</p>
  
  <pre><code>$file = 'log.txt';
  $current = file_get_contents($file);
  $current .= ",clicked:link";
  file_put_contents($file, $current);
  </code></pre>
  
  <p>Possible ideal side result: proving this isn't possible and forcing PHP/Node/Java to be used ;)</p>
  
  <p>In reply to those suggesting local storage :  I'm not storing unique key/value pairs and that is very much like setting a cookie. Similarily there are file size limits.
  To those suggesting web SQL such as SQLite in chrome - there are file size limits if it's not a chrome extension. The only way I see that working is if I were to find the location of the file in the windows directory (C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data\Default\databases) and upload that from the schedules task. Perfectly feasible but it is not a desirable answer.</p>