Phonegap의 소스 파일을 다운로드하거나 다운로드하는 방법을 알아 보겠습니다.Phonegap html 파일 다운로드 및 바꾸기 (소스)
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" charset="utf-8" src="cordova-2.3.0.js"></script>
<script type="text/javascript">
function onBodyLoad()
{
document.addEventListener("deviceready", onDeviceReady, false);
}
function downloadFile(){
window.requestFileSystem(
LocalFileSystem.PERSISTENT, 0,
function onFileSystemSuccess(fileSystem) {
fileSystem.root.getFile(
"dummy.html", {create: true, exclusive: false},
function gotFileEntry(fileEntry){
var sPath = fileEntry.fullPath.replace("dummy.html","");
var fileTransfer = new FileTransfer();
fileEntry.remove();
fileTransfer.download(
"https://dl.dropbox.com/u/xxxxx/index_2.html",
sPath + "index_aerosoft.html",
function(theFile) {
console.log("download complete: " + theFile.toURI());
showLink(theFile.toURI());
},
function(error) {
console.log("download error source " + error.source);
console.log("download error target " + error.target);
console.log("upload error code: " + error.code);
}
);
},
fail);
},
fail);
}
function showLink(url){
alert(url);
var divEl = document.getElementById("ready");
var aElem = document.createElement("a");
aElem.setAttribute("target", "_blank");
aElem.setAttribute("href", url);
aElem.appendChild(document.createTextNode("Ready! Click To Open."))
divEl.appendChild(aElem);
}
function fail(evt) {
console.log(evt.target.error.code);
}
function onDeviceReady()
{
downloadFile();
}
</script>
</head>
<body onload="onBodyLoad()">
<br />
<p>
DOWNLOADING FILE...<br />
<span id="ready"></span>
</p>
</body>
</html>
파일을 다운로드하여 액세스 할 수 있지만 Phonegap의 'www'폴더에 다운로드 경로를 설정할 수 있습니까? 아니면 파일의 경로가
엑스 코드 콘솔이 날 file://localhost/var/mobile/Applications/1AE34410-C57E-4896-8616-042E386552E0/Documents/index_2.html
알려줍니다 (그래서 난 그 길에 연결할 수) 내가 어떻게 든 링크 할 수 있습니다 알아낼 방법? 안드로이드 자산 폴더 읽기 전용되고 HTML 당신이 장소를 작성했기 때문에 자바를 프로그래밍 할 수있는 경우
당신은 소스 코드를 대체 할 수
앱에 번들로 제공되는 파일을 덮어 쓸 수 없습니다. 영구 저장 장치의 위치에만 쓸 수 있습니다. – codemonkey