![](/img/trans.png)
[英]How to scroll file browser of internal memory triggered by Cordova mfilechooser plugin
[英]The cordova plugin 'mfilechooser'' is not working on Android phone with cordova 6.3.1
mfilechooser插件适用于我在Android模拟器或设备上基于Cordova的应用程序。 没有错误报告,但选择器未启动。
这是我的代码片段。
index.js
function choose(){
window.plugins.mfilechooser.open([], function (uri) {
alert(uri);
}, function (error) {
alert(error);
});
}
function onDeviceReady() {
}
function domLoaded(){
document.addEventListener("deviceready", onDeviceReady, false);
}
index.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy"
default-src 'self';
connect-src *;
style-src 'self' data: chrome-extension-resource: 'unsafe-inline';
img-src 'self' data: chrome-extension-resource:;
frame-src 'self' data: chrome-extension-resource:;
font-src 'self' data: chrome-extension-resource:;
media-src *;>
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<title>Hello World</title>
</head>
<body onload="domLoaded()">
<div>
<h1>Apache Cordova</h1>
</div>
<div>
<button onClick="choose()">choose file</button>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</body>
</html>
Cordova 6.3.1文件选择器: https : //github.com/MaginSoft/MFileChooser
谢谢你的帮助
您的CSP可能不允许您运行内联JavaScript,因此onclick并未执行任何操作。
尝试将其添加到您的Content-Security-Policy
元标记中
script-src 'unsafe-inline';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.