Re: [whatwg] Accessing local files with JavaScript portably and securely

On 2017-04-11 Patrick Dark wrote:
> Jan Tosovsky 2017-04-10 wrote:
> > > On 2017-04-09 David Kendal wrote:
> > >
> > > ... there are many possible uses for local static files 
> > > accessing other local static files: the one I have in mind 
> > > is shipping static files on CD-ROM or USB stick...
> >
> > So basically you need
> > (1) JSON /* the folder structure stored in JavaScript objects */
> > (2) link to that JSON in your HTML file
> > (3) JavaScript in your HTML file, which renders JSON data to the page
> >
> > In my case both WebHelp pages and JSON is generated via XSLT from XML
> > source.
> 
> There's no reason to use JavaScript for displaying a table of contents.
> If the file structure is fixed, you can simply hard-code static XML
> entries in an XSLT stylesheet.

While slighty off-topic, my goal was to reduce the final HTML file size. The more pages, the larger ToC so the size of the complete set grows exponentially. If ToC is extracted and then just linked in every HTML page, it reduces the total size significantly. If documentation is shipped together with desktop app in the form of installer, it is better to keep it as small as possible.

> Granted, Google Chrome won't do XSLT transformations for local files,
> but that seems to be more of a browser deficiency than a specification
> issue. 

Sorry not being precise, that mentioned XSLT transformation (for my DocBook XML) is performed once off-the-browser, producing linked static HTML pages (and also JSON with the file hierarchy). I wanted to emphasize that generating JSON can be, in specific cases, nicely integrated into current generating workflow (the file structure is already available in DocBook XSL stylesheets for other purposes so it was quite easy to reuse it for generating JSON for ToC).

Jan

Received on Tuesday, 11 April 2017 19:23:21 UTC