当我点击网址使用$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
});
答案 0 :(得分:1)
您可以尝试以下选项。
iOS:
cordova.InAppBrowser.open(yourURL, '_blank', 'toolbar=no');
Android:
cordova.InAppBrowser.open(yourURL, '_blank', 'location=no');
在您的情况下, cordova.InAppBrowser
为$cordovaInAppBrowser
。
答案 1 :(得分:0)
我可以使用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;
}
对我来说它完美无缺。希望对某些人有所帮助。