Hello,
Thank you for your contribution and I will update xsltforms.js accordingly.
I wonder if using a get submission with just "file://" would not do the same
with old browsers not supporting Blob. Did you try this before?
Regards,
--Alain
> Le 9 août 2014 à 12:17, Till Königshofen <[email protected]> a
> écrit :
>
>
> Hello,
>
> I was looking for a way to load XML files from the local file system
> into an XForms instance without sending them to a server first.
>
> I defined a function which retrieves a Blob URL
> (http://www.w3.org/TR/FileAPI/#url) from a file selected with a normal
> <input id="upload" type="file"/> element:
>
> <script>
> getBlobURL = function() {
> return URL.createObjectURL(document.getElementById('upload').files[0]);
> }
> </script>
>
> The submission element is defined as follows:
>
> <xf:submission id="load" replace="instance" instance="data" method="get"
> serialization="none">
> <xf:resource value="javascript:getBlobURL()"/>
> </xf:submission>
>
> To get this to work, I changed line 194 in xsltforms.js (build 604) to
>
> if (uri.match(/^[a-zA-Z0-9+\.\-]+:\/\//) || uri.match(/^blob:/)) {
>
> because otherwise the Blob URL gets "prefixed" with the current URL
> loaded in the browser.
>
> The complete example is attached.
>
> Regards
> Till
> ------------------------------------------------------------------------------
> _______________________________________________
> Xsltforms-support mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/xsltforms-support------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support