科尔多瓦inappbrowser和输入文件 [英] cordova inappbrowser and input file
问题描述
我的问题是,这个网站有一个文件上传功能,这个功能不适用于Android(它适用于iOS)。
我看到这种行为在Android上是正常的,但有没有办法使它工作,或者它绝对不是一个选项?
谢谢
编辑1
我尝试创建新的应用程序,像这样一个简单的页面(在AWS上托管):
$ p $ < html>
< head>
< title>上传测试!< /标题>
< / head>
< body>
< div>上载测试< / div>
< div>
< input type =fileid =imgFilename =files []accept =image / x-png,image / gif,image / jpeg>
< / div>
< / body>
我在我的Cordova项目中生成了index.html。
$ p $ < script type =text / javascript>
document.addEventListener(deviceready,function(event){
console.log('TEST CONSOLE LOG!');
var url ='https:// s3-eu-west -1.amazonaws.com/***/file-upload.html';
ref = window.open(url,_blank,location = no,toolbar = no,zoom = no,hidden = yes );
ref.addEventListener('loadstop',function(){
ref.show();
});
ref.addEventListener('loaderror ',function(){
ref.close();
ref = undefined;
});
},false);
< / script>
它不适用于我的nexus 5(android M)。
cordova plugin删除cordova-plugin-inappbrowser -camera
cordova插件添加https://github.com/jverlee/cordova-plugin-inappbrowser-camera.git
顺便说一下,如果我按照他的指导,我只会得到: I have a iOS and Android application, and I load a external website inside my app (this external website is mine too).
My problem is that this website has a file upload feature and this feature does not work on Android (it works on iOS).
I saw that this behavior is normal on Android, but is there any way to make it work or it's definitely not an option ?
Thank you EDIT 1 I tried to create a new app with a simple page like this (hosted on AWS) : and I added this script in my generated index.html in my Cordova project. It doesn't work on my nexus 5 (android M). By the way, if I follow his guide, I only gets:
Error: Cannot read property 'variables' of undefined 这篇关于科尔多瓦inappbrowser和输入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
错误:无法读取未定义的属性'变量'<html>
<head>
<title>Upload Test !</title>
</head>
<body>
<div>Upload Test</div>
<div>
<input type="file" id="imgFile" name="files[]" accept="image/x-png, image/gif, image/jpeg">
</div>
</body>
<script type="text/javascript">
document.addEventListener("deviceready", function(event) {
console.log('TEST CONSOLE LOG !');
var url = 'https://s3-eu-west-1.amazonaws.com/***/file-upload.html';
ref = window.open(url, "_blank", "location=no,toolbar=no,zoom=no,hidden=yes");
ref.addEventListener('loadstop', function () {
ref.show();
});
ref.addEventListener('loaderror', function () {
ref.close();
ref = undefined;
});
}, false);
</script>
@Verl
's code is pretty good! However, it cannot be installed through his installation guide... So here is mine:cordova plugin remove cordova-plugin-inappbrowser-camera
cordova plugin add https://github.com/jverlee/cordova-plugin-inappbrowser-camera.git