Saving offline changes in Internet Explorer

I'm looking to create an app that:

  1. Works in Chrome, Firefox, Internet Explorer and Safari.
  2. Only uses standardised HTML5, CSS3 and Javascript.
  3. Uses identical code for all browsers (i.e. does not conditionally branch to different code for different browsers).
  4. Does not require Javascript libraries (such as jQuery).
  5. Works offline (using file protocol).
  6. Allows local saving of data.

The options I've considered and rejected:

  • Cookies (too small).
  • window.name (hack).
  • WebSQL (outdated).
  • localStorage (doesn't work with file protocol in Internet Explorer).
  • IndexedDB (doesn't work with file protocol in Internet Explorer).
  • File API: Writer (cancelled by W3C).
  • FileSystem API, including FileWriter (Chrome only).
  • Using window.open with a Data URI (hack and can't programmatically specify file name/type for saving from browser).
  • Download attribute of anchor element (Chrome and Firefox only).

The only remaining option that I am aware of is to use Javascript to write to the page source itself, and then to manually save the page from the browser menu, for example:

<html> <head> <script id="storeElement"> var storeVariable = ""; </script> <script> var writeToStore = function () { document.getElementById("storeElement").textContent = 'var storeVariable = "valueToBeStored";'; }; </script> </head> <body> <button onclick="writeToStore()">Write To Store</button> </body> </html>

However, although Firefox and Chrome save any such dynamic changes, giving this:

<script id="storeElement"> var storeVariable = "valueToBeStored"; </script>

Internet Explorer does not save any such dynamic changes - it just saves the initial source code, like this:

<script id="storeElement"> var storeVariable = ""; </script>

(Unless you literally "Inspect element" then cut and paste from the DOM Explorer, which is way too manual).

So, given my initial six requirements at the top of this page:

  1. Are there any other alternatives?
  2. Is there anything I've missed or misunderstood?
  3. Is it at all possible to save offline changes in Internet Explorer?

Thanks in advance for any help you can give!

Category:javascript Views:0 Time:2018-05-12

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.111 (s). 11 q(s)