我正在尝试通过javascript阅读应用程序的文档文件夹。实际上,我想在app的文档文件夹中保存一个图像。如何使用j UIWebView
从app的文档文件夹中获取图像?
我试过了:
var file = '/Documents/' + possible[Math.floor(Math.random() * possible.length)] + '.png'
var file = '//Documents/' + possible[Math.floor(Math.random() * possible.length)] + '.png'
var file = '/Documents/' + possible[Math.floor(Math.random() * possible.length)] + '.png'
var file = 'app://Documents/' + possible[Math.floor(Math.random() * possible.length)] + '.png'
Js代码:
function basicLoad(location) {
var possible = ['image'];
var file = 'img/' + possible[Math.floor(Math.random() * possible.length)] + '.png'
return {
file: file,
shownFile: location.protocol + '//' + location.host + location.pathname + file
};
}