« Qaop/Java « Qaop/JS

This page tests possible ways of copying file data between a web page and a local system without server interaction. Data can be generated with Javascript and then saved to client disk, or script on the page can process file supplied by the user.

read

Read local file using File API. [File API (draft)] Latest draft specifies FileReader object. [FileReader MDC] Earlier Firefoxes support reading file directly. [File MDC]

Works in Firefox 3+ and Chrome.

Show open dialog from javascript:

Firefox 3.6- does not support click() method on input[type=file] [Mozilla bug 36619], nor label for click routing (they call it insecure, but don't understand why). Same in Opera. Well known opacity:0 hack must be used: [quirksmode.org, Styling an input type="file"]
open file

    write

    There is draft that defines FileWriter [File API: Writer (draft)] but it is not supported yet.

    Currently Data URI [RFC 2397] can be used to save a file: Save hello.zip.

    Can be initiated from javascript by assigning location.href property:

    Problem 1: No way to specify filename.

    Problem 2: No way to force saving. View is the default.

      drop

      Dragging file to the page. [whatwg.org, HTML5, Drag and Drop]
      Works on Firefox 3.5+, Chrome

        drag

        For dragging a file from the page, DownloadURL with data URL can be used. [HTML5 Rocks, Drag and Drop Download in Chrome]

        Drag one of these:
        hello.txt
        hello.zip
        ball.png

        This works in Chrome (Webkit).

          ✻ ✻ ✻
          Your browser:
          ~jb