4

Firefox - How to enable an HTML file to save itself locally?

I use Firefox to open and edit TiddlyWiki.html files. https://github.com/Jermolene/TiddlyWiki5 These are HTML with a Javascript app packaged together in one file.

They also have this Firefox extension called TiddlyFox that can enable the TiddlyWiki.html file to save itself locally in the file you just opened. It first asks if you want the this ability to be enabled on that particular file and if you click Yes it works.

I was wondering how this behavior is achieved via the Firefox Extension? (ex source code here: https://github.com/TiddlyWiki/TiddlyFox )

unom
  • 11,438
  • 4
  • 34
  • 54
  • I don't quite understand. Are you asking how to save a file to hard disk via privileged js? – Noitidart Feb 08 '15 at 09:50
  • This is how TiddlyFox saves file: https://github.com/TiddlyWiki/TiddlyFox/blob/6cf9c9ee6e128a681548529316b3d31a8362fe0d/content/overlay.js#L84 – Noitidart Feb 08 '15 at 11:45
  • I see, so using Javascript, TiddlyFox sets up a local environment where saving files locally is possible. Where does https://github.com/Jermolene/TiddlyWiki5 make the call to this local environment and actually save? – unom Feb 09 '15 at 10:58
  • Looks like he's using 3 different ways and going with whatever works: https://github.com/Jermolene/TiddlyWiki5/blob/85952e6f59f0eddc806d54d10fd0e208512c36d9/editions/tw2/source/tiddlywiki/js/FileSystem.js#L117 `mozillaSaveFile`, `ieSaveFile`, `javaSaveFile` so its using some firefox specific, then internet explorer specific activex, then falling back on java. It doesnt look like it supports safari, google chrome, opera, do they have saving? – Noitidart Feb 09 '15 at 15:42
  • Google Chrome has the filesystem api, i dont know if this is how Tiddly does it but this topic solution shows how to do it in chrome: http://stackoverflow.com/a/13779352/1828637 – Noitidart Feb 10 '15 at 03:38
  • Hmm. I see, thank you for clearing up the topic for me. – unom Feb 10 '15 at 06:17

1 Answers1

0

Google Chrome has the filesystem api, i dont know if this is how Tiddly does it but this topic solution shows how to do it in chrome:

http://stackoverflow.com/a/13779352/1828637

Noitidart comment Feb 10 '15 at 3:38

unom
  • 11,438
  • 4
  • 34
  • 54