简体   繁体   English

AJAX是否可以从Cordova应用程序访问内部存储?

[英]AJAX access to internal storage from Cordova app?

Is there a way to save a file from the Java side so that it is accessible via a web request (AJAX, img/script src, link href, etc)? 有没有一种方法可以从Java端保存文件,以便可以通过Web请求(AJAX,img / script src,链接href等)进行访问?

I can write files via openFileOutput , is that directory accessible via the JS app? 我可以通过openFileOutput写入文件,该目录可以通过JS应用程序访问吗?

I know I can write files to external media and access those via the File api, but that's not what I'm looking for (though will have to revert to this if necessary). 我知道我可以将文件写入外部媒体并通过File api访问这些文件,但这不是我想要的(尽管在必要时必须恢复为该状态)。

The usage is writing images to a cache via a plugin and just loading those images by a normal img src, though would like to use this for other things. 用法是通过插件将图像写入缓存,然后通过普通的img src加载这些图像,尽管也想将其用于其他用途。

Yes, PhoneGap apps have access to this directory. 是的,PhoneGap应用程序可以访问此目录。 The path to that directory would be: 该目录的路径为:

file:///data/data/{package name}/{file name}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM