Sha*_* HS 5 camera cordova inappbrowser hybrid-mobile-app cordova-plugins
我有一个使用Apache Cordova开发的混合应用程序,在该应用程序中,我使用的是“ inappbrowser”。现在的要求是从浏览器中打开“相机”或“图库”,我不知道如何实现。
为了开发该应用程序,我使用了bone.js,JQuery,bootstrap.js。
这是Backbone的View的代码片段:
var mainScreenView = Backbone.View.extend({
el: $('.panel'),
templateMainScreen: _.template($('#templateOne').html()),
events: {
"click #inputBtnSubmit": "openWebView",
"click #clickSettings": "openSettings"
},
initialize: function(){
this.render();
},
render: function () {
alert($(this.el).find('.panel-body'));
var bindElement = $(this.el).find('.panel-body');
bindElement.html(this.templateMainScreen());
return this;
},
openWebView: function () {
var textValue = $('#inputValue').val();
cordova.InAppBrowser.open('**Link to an external webpage which asks for Camera or Gallery control** ', '_blank', 'location=no');
// After inappbrowser is called to load a external webpage (On a button click Camera Intent or Gallery should open)
}
});
var appView = new mainScreenView;
Run Code Online (Sandbox Code Playgroud)
提前致谢。
我最终没有使用 inappBrowser,而是实现了 HTML iframe。也就是说,我想要在 appBrowser 中执行的操作,现在我可以使用 iframe 执行。您可以访问相机、图库或文件资源管理器,类似于本机手机的浏览器。
以下是我为解决上述问题所做的工作:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<title>Hello World!</title>
<style type='text/css'>
body, html, iframe {
margin: 0;
padding: 0;
border: 0px none;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<script type="text/javascript" src="cordova.js"></script>
<iframe src="http://SomeWebPage" width="97%" height="97%"></iframe>
</body>
Run Code Online (Sandbox Code Playgroud)
希望这对其他人有帮助。
| 归档时间: |
|
| 查看次数: |
6379 次 |
| 最近记录: |