4

Ok, here we discussed the essence of the problem: in some browsers like Chrome and Opera HttpRequests to local files is turned off by default.

Now the question is: how to build such HTML+javascript viewer of HTML documents, that:

  1. would run locally on any (or most of) browser(s) without additional tuning;
  2. would not use frames;
  3. would have an ability to work with many different files(5-10k);

1 Answer 1

2

It can't be done in straight HTML/Javascript if you want to load files via Javascript using AJAX requests. There are good security reasons to not allow local files script access to other files on the local system (see my answer here for more details), so most browsers will not allow this without special user configuration.

So your options are:

  • Don't load files with Javascript, use frames or another mechanism. If, as you state in the other question, you're shipping all this on CD, you might want to consider using some sort of build system that allows you to create static files using templates and either a database or flat-file content - Jekyll is one option I know of.

  • Ship an executable along with the files that can either run a local webserver or run HTML files in an application context. I think Appcelerator Titanium might fit the bill.

1
  • This is a great answer, fully covering the topic. Thank you.
    – iehrlich
    Commented Oct 5, 2011 at 22:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.