How to read local file that in located in the same directory as html using javascript -
i have application creates html files containes lot of info draw. files alwayes browsed local file scheme (no http protocol @ all).
i have thought compress info , place in raw format in separate .dat file set in same place .html one.
it not problem read , uncompress .dat file when on web server. don't how read when both files .html , .dat local.
of course of study 1 can utilize browser file objects in case user alwayes asked stupid action chose the file control.
but don't how read when both files .html , .dat local.
i take mean javascript within html file. depending on browser, can't except via file api (which, you've observed, requires have user select file in input[type=file]
element).
the way you'd want via ajax (xmlhttprequest
), , work in some browsers, not in others. chrome, instance, denies attempts utilize ajax file://
urls (e.g., in pages served file system), local pages, when you're using relative url thefile.dat
. ie allows (or @ least, older versions of ie did; haven't tried lately).
so unfortunately, think way can via file api, attendant input[type=file]
.
javascript file local decompression
No comments:
Post a Comment