当我点击网址使用$cordovaInAppBrowser.open(url, '_blank', options)
打开网址时,它会在我打开InAppBrowser时将其退回到网址,它显示出奇怪的行为。
这是我的代码
var options = {
location: 'yes',
clearcache: 'yes',
toolbar: 'no'
};
$cordovaInAppBrowser.open(url, '_blank', options)
.then(function (event) {
// success
})
.catch(function (event) {
// error
});
您可以尝试以下选项。
iOS:
cordova.InAppBrowser.open(yourURL, '_blank', 'toolbar=no');
Android:
cordova.InAppBrowser.open(yourURL, '_blank', 'location=no');
在你的情况下cordova.InAppBrowser
是$cordovaInAppBrowser
。
我能够使用Android和ios的代码解决它
self.viewLink = function (viewUrl) {
var url = (viewUrl.match('http')) ? viewUrl : 'http://' + viewUrl;
var options = {
location: 'no',
clearcache: 'yes',
toolbar: 'yes',
closebuttoncaption: 'Done'
};
$cordovaInAppBrowser.open(url, '_blank', options)
.then(function (event) {
// success
})
.catch(function (event) {
// error
});
return false;
}
对我来说它完美无缺。希望如此,对某些人来说,它会起作用。