Http 需要帮助来实现PhoneGap/Cordova ContentSync插件吗
有关于contentsync phonegap插件()的问题。Http 需要帮助来实现PhoneGap/Cordova ContentSync插件吗,http,xmlhttprequest,phonegap-plugins,cordova-plugins,Http,Xmlhttprequest,Phonegap Plugins,Cordova Plugins,有关于contentsync phonegap插件()的问题。 如果有人能帮忙,我们将不胜感激。 问题的核心是我的REST服务器只允许我通过发送GET请求下载.epub文件(与.zip相同),类似于: https://test-api.books.com/api/getPublishedEpub?session_hash=1235&publication_id=abv1243' 提供指向插件“.sync”调用的此链接时,我从服务器获得“无效请求方法”响应… 在尝试下载普通的.zip时,
如果有人能帮忙,我们将不胜感激。 问题的核心是我的REST服务器只允许我通过发送GET请求下载.epub文件(与.zip相同),类似于:
https://test-api.books.com/api/getPublishedEpub?session_hash=1235&publication_id=abv1243'
提供指向插件“.sync”调用的此链接时,我从服务器获得“无效请求方法”响应…在尝试下载普通的.zip时,一切正常
var pub_id = $scope.currentBook.publication_id, epubUrl = 'https://test-api.books.com/api/getEpub?session_hash='
+ $rootScope.sessionHash+ '&publication_id=' + pub_id;
var downloadBtn = document.getElementById("downloadBtn");
console.log('Download cliked');
var sync = ContentSync.sync({ src: epubUrl, id: 'book'+ pub_id});
sync.on('progress', function (data) {
downloadBtn.innerHTML = "Downloading: " + data.progress + "%";
});
sync.on('complete', function (data) {
console.log(data.localPath);
for (var x = 1; x <= 17; x++) {
var fileUrl = "file://" + data.localPath;
console.log(fileUrl);
}
downloadBtn.innerHTML = 'Download';
});
var pub_id=$scope.currentBook.publication_id,epubUrl='https://test-api.books.com/api/getEpub?session_hash='
+$rootScope.sessionHash+'&publication_id='+pub_id;
var downloadBtn=document.getElementById(“downloadBtn”);
log(“下载剪辑”);
var sync=ContentSync.sync({src:epubUrl,id:'book'+pub_id});
sync.on('progress',函数(数据){
downloadBtn.innerHTML=“下载:”+data.progress+“%”;
});
sync.on('complete',函数(数据){
log(data.localPath);
对于(var x=1;x