离子1主题浏览器无法在Android设备中打开 [英] ionic 1 Themeable Browser not opening in android device
本文介绍了离子1主题浏览器无法在Android设备中打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这里我的流程...
我添加了 ios和android
平台
安装它 cordova插件添加cordova-plugin-themeablebrowser
我的示例pdf : http://www.pdf995.com/samples/pdf.pdf
github中的插件: https:// github.com/initialxy/cordova-plugin-themeablebrowser
that plugin in github: https://github.com/initialxy/cordova-plugin-themeablebrowser
我的 index.html
:
<ion-pane>
<ion-header-bar class="bar-stable">
<h1 class="title">Ionic Blank Starter</h1>
</ion-header-bar>
<ion-content ng-controller="FileOpenerController">
<button class="button button-icon loginnavbtn" ng-click="openpdf()">pdf open</button>
</ion-content>
</ion-pane>
我的 .js
app.controller('FileOpenerController', function($scope, $ionicPlatform,$themeablebrowser) {
var options = {
toolbar: {
height: 44,
color: '#cdcdcd'
},
title: {
color: '#003264ff',
showPageTitle: true
},
closeButton: {
image: 'close',
imagePressed: 'close_pressed',
align: 'left',
event: 'closePressed'
},
backButton: {
image: 'back',
imagePressed: 'back_pressed',
align: 'left',
event: 'backPressed'
},
forwardButton: {
image: 'forward',
imagePressed: 'forward_pressed',
align: 'left',
event: 'forwardPressed'
},
closeButton: {
image: 'close',
imagePressed: 'close_pressed',
align: 'left',
event: 'closePressed'
},
menu: {
image: 'menu',
imagePressed: 'menu_pressed',
title: 'Select for quick menu',
cancel: 'Cancel',
align: 'right',
items: [
{
event: 'btn1Pressed',
label: 'Button1'
},
{
event: 'btn2Pressed',
label: 'Button2'
}]
};
}
function openpdf() {
// dont know how to call my pdf url....not able to get the correct code...
}
});
我很怀疑。
我的 $ themeablebrowser
是否正确我在 app.controller中定义了
。
不知道如何在我的单击
方法中编码以打开我的pdf in 主题网址
don't know how to code inside my click
method to open my pdf in Themeable url
提前致谢
推荐答案
你必须添加这样的网址
$scope.openpdf= function(){
cordova.ThemeableBrowser.open('here goes your url', '_blank', {...}
}
此处示例
$scope.openpdf= function(){
cordova.ThemeableBrowser.open(' http://www.pdf995.com/samples/pdf.pdf', '_blank', {
statusbar: {
color: '#ffffffff'
},
toolbar: {
height: 44,
color: '#f0f0f0ff'
},
title: {
color: '#003264ff',
showPageTitle: true
},
backButton: {
image: 'back',
imagePressed: 'back_pressed',
align: 'left',
event: 'backPressed'
},
forwardButton: {
image: 'forward',
imagePressed: 'forward_pressed',
align: 'left',
event: 'forwardPressed'
},
closeButton: {
image: 'close',
imagePressed: 'close_pressed',
align: 'left',
event: 'closePressed'
},
customButtons: [
{
image: 'share',
imagePressed: 'share_pressed',
align: 'right',
event: 'sharePressed'
}
],
menu: {
image: 'menu',
imagePressed: 'menu_pressed',
title: 'Test',
cancel: 'Cancel',
align: 'right',
items: [
{
event: 'helloPressed',
label: 'Hello World!'
},
{
event: 'testPressed',
label: 'Test!'
}
]
},
backButtonCanClose: true
}).addEventListener('backPressed', function(e) {
alert('back pressed');
}).addEventListener('helloPressed', function(e) {
alert('hello pressed');
}).addEventListener('sharePressed', function(e) {
alert(e.url);
}).addEventListener(cordova.ThemeableBrowser.EVT_ERR, function(e) {
console.error(e.message);
}).addEventListener(cordova.ThemeableBrowser.EVT_WRN, function(e) {
console.log(e.message);
});
}
这篇关于离子1主题浏览器无法在Android设备中打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文