Is there any way to load a local file using an html document that lives on my HD? I was thinking of making an html-based overview page of a project that I'm working on, but I can't seem to find a way to get the browser to open my text based files in the native application that they are bound to (for ex., TextWrangler or whatnot). Does anyone h开发者_高级运维ave experience with this?
It seems that the browser is by design, only allowed to handle files inline.
It is definitely by design. You don't want the browser to have direct execution access to local files on your machine for security reasons.
You can do it on Windows using ActiveX. There is a simple example at http://www.tutorial5.com/content/view/51/45/ and more elaborate schemes are possible. But ActiveX is not cross platform, and I doubt it is possible to do similar on proper secure operating systems.
Update: Here is a possible way to configure Firefox to do it on any operating system, but this would only really work for your own personal use: How open a local file with the associated program from a web page?
You can write a script, which wraps your filenames (+ xyz-info) into a html-template.
While you can refer to local files as file://users/me/Documents/stuff.txt its unlikely a user will have files where a remote server might expect. As well as the security implications of doing such a thing.
精彩评论