1

I'm building a little locally run CSS driven site map for auditing a huge intranet site. I've already coded the ability, to bring up a context menu which provides for options to make updates to the DOM of index.html. I would like to save these changes to index.html.

I know JavaScript doesn't allow manipulation to the client file system, but I've also read in places that it is allowed if the JavaScript is retrieved from the local machine.

Can anyone confirm this and point me in the right direction on how this can be done WITHOUT setting up a local server?

3
  • 1
    This entire concept is intrinsically very localized -- the code you write won't be portable in any form or fashion. I really suggest looking at the localStorage link that Alex Key provided below. It's going to be your best bet for doing this and having it work on more than just one browser on one system. Commented Jun 29, 2011 at 14:42
  • 2
    You may want to check out TiddlyWiki, which is sort-of the mac daddy of locally-hosted standalone web applications. Commented Jun 29, 2011 at 14:45
  • @Reid and @Alex - I guess I don't fully understand HTML5 local storage, even after reading the link Alex suggested. As far as portability, I don't need it. It just needs to all work within it's root directory without any dependencies on a server or database. Commented Jun 29, 2011 at 14:50

2 Answers 2

3

It is possible to write to the local filesystem using the Filewriter object, as described here: http://www.html5rocks.com/en/tutorials/file/filesystem/

It is also possible to edit local files using the File System Access API.

Sign up to request clarification or add additional context in comments.

Comments

2

I don't think this is possible even in IE's trusted zone, at least not with pure javascript (you may be able to with an activeX control / maybe flash or silverlight with the right trust levels).

It's a slightly different subject, but there is a writeup on HTML 5 local storage which may help for background reading: http://diveintohtml5.ep.io/storage.html

4 Comments

I thought of that, but I really need to be able to save the file so that it can be opened by anyone in any browser from the shared drive in which this this thing resides. Thanks for the tip though.
No worries @Ben, you might find some luck with trusted silverlight - but even then it probably will only write to sandboxed files. Or unfortunatly may wish to look at alternative methods to producing what you need. You can probably save files with a firefox extension - but that seems a little overkill.
A firefox extension may be the best solution for my tech knowledge. That would make it easy enough to make work on others computers too.
Glad to be of assistance, though seems like a lot of work to write out an html file. You may wish to approach your problem differently. Perhaps considering a tool like WebMatrix to do your editing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.