本文介绍了FileTransfer在Phonegap代码401的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我使用Phonegap'FileTransfer。

Hey I'm using Phonegap' FileTransfer. And I get a 401 code 3 error (unauthorized) httprequest.

我执行的FT方法:

    var ft = new FileTransfer();
    ft.download(startUrl + filename, dlPath, function(e){
        console.log("Successful download of "+e.fullPath);
        renderPicture(e.fullPath);
    }, onError);

请求/响应:

07-24 08:58:12.750: D/CordovaLog(3744): {"target":"file:///mnt/sdcard/dk.test.html5Generic/","source":"http://mobilitycms.test.dk:9090/content/picture/menu/showroom","http_status":401,"code":3}

如果你需要测试的路径,你需要删除:9090我有,因为Im在内部网络。

If you need to test the path you need to remove the :9090 I have that on because Im on an internal network.

任何帮助都会感谢您将此错误销毁:-P

Any help would be appreciated to get this error destroyed :-P

推荐答案

问题是我忘了添加我的cordova xml下的网址作为白名单:

Problem was that I had forgotten to add the url under my cordova xml as a whitelist:

Android: project - res - xml - cordova.xml

这篇关于FileTransfer在Phonegap代码401的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-25 13:58