开发者

Is it possible to get to external sqlite3 file from chrome?

External is that the file lies somewhere on disk out of chrome's directory structure. I was able to create database from content script, but that file was buried deep with chrome dir structure. I nee开发者_运维知识库d instead to access a hard path like d:\bases\mydb.db3 etc.

I do not how to get to it, is it done from content scripts or background pages ?

Do google extenstions have a hard written security restrictions that don't allow them to reach out of chrome structure into disk ?


The only way to access the file system like how you stated is through native plugins (NPAPI) mentioned here http://code.google.com/chrome/extensions/npapi.html

There are other ways to use file access such as the HTML5 File API. A good tutorial can be read from HTML5 Rocks website http://www.html5rocks.com/tutorials/file/filesystem/ That will not read a file that is not managed from the Web.

If you want to bundle a database file to your extension, I recommend dropping SQLite and using compressed JSON. You bundle it up relative to your extension, and fetch it using XmlHttpRequest. Chrome has JSON bundled into the browser, so you can marshal and unmarshal easily.

Hope that helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜