javascript - Access local files from HTML5 Desktop Application in html folder - Stack Overflow

HTML5 is great and I can replace my existing desktop application with it, but just a little security re

HTML5 is great and I can replace my existing desktop application with it, but just a little security restriction prevents me to plete my job. I plan to create a simple desktop application pletely with HTML5 so it can run on any mobile and desktop devices that support HTML-5.

I know about the browser security on local file and the reason behind it, but I don’t know why I couldn’t find a way to grant read-only access to a folder as sandbox. My application does not need to write a file or even does not need to read a file outside of It main html folder. It needs to read the local file just in same folder same as it do on domain.

So please let me know:

  1. Can run browser with specific mand to force it grant access to local file that exists in same folder of HTML? It should not disable all local security restriction just grant HTML access to file in same folder or subfolder.
  2. Is it cross platform method to map a local folder as local host that work on mobile platforms?
  3. Is there any manifest file exists to put in folder to grant read access in same HTML folder?
  4. Is there any way to grant read-only access to a folder as sandbox?

Note: I don't want use third party solution such as XULRunner, Mozilla Prism, Adobe Air or any other third party, I need HTML-5 solution to be cross platform if there is any.

Any idea is wele.

HTML5 is great and I can replace my existing desktop application with it, but just a little security restriction prevents me to plete my job. I plan to create a simple desktop application pletely with HTML5 so it can run on any mobile and desktop devices that support HTML-5.

I know about the browser security on local file and the reason behind it, but I don’t know why I couldn’t find a way to grant read-only access to a folder as sandbox. My application does not need to write a file or even does not need to read a file outside of It main html folder. It needs to read the local file just in same folder same as it do on domain.

So please let me know:

  1. Can run browser with specific mand to force it grant access to local file that exists in same folder of HTML? It should not disable all local security restriction just grant HTML access to file in same folder or subfolder.
  2. Is it cross platform method to map a local folder as local host that work on mobile platforms?
  3. Is there any manifest file exists to put in folder to grant read access in same HTML folder?
  4. Is there any way to grant read-only access to a folder as sandbox?

Note: I don't want use third party solution such as XULRunner, Mozilla Prism, Adobe Air or any other third party, I need HTML-5 solution to be cross platform if there is any.

Any idea is wele.

Share Improve this question asked Feb 12, 2012 at 17:03 Mohammad NikravanMohammad Nikravan 1,8692 gold badges21 silver badges24 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 1

If you need that file so much, why not just load it dynamically inside a JS script as a json object.

So, in other words, put the contents of the file into a js script, and strucutre the file contents into JSON format, then load that script on load or when you require it.

Alternately if you need file IO use localstorage.

according to this site, launching chrome from the cmd with the parameter --allow-file-access-from-files will disable this security feature

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744720033a4589855.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信