2015-09-26 95 views
0

在Ionic應用程序中,我使用ngCordova's $cordovaInAppBrowser來打開Apple Play商店URL。它打開應用程序商店,但它不會進入。然後。相關代碼:

$cordovaInAppBrowser.open(mktUrl, '_system', {location: 'yes', clearcache: 'yes', toolbar: 'no'}). 
then(function(event) { ¬        
     console.log("inside then"); ¬       
     $state.go('odetails'); 
    }¬ 

mktUrl是一款應用的應用商店URL。

它不會產生任何錯誤。但它不起作用。我該如何解決這個問題?

回答

0

那裏。

如果您從_system更改爲_blank,cordova會使用與您的應用容器相同的webview,並且承諾會發揮作用。

我使用這個代碼:

  var inAppBrowserOptions = { 
       location: 'yes', 
       clearcache: 'no', 
       hardwareback: 'no' 
      }; 
      if (!site.toLowerCase().match(/^htt(p|ps):\/\//)) { 
       site = 'http://' + site; 
      } 
      $cordovaInAppBrowser.open(
       site, 
       '_blank', 
       inAppBrowserOptions 
      ).then(function (event) { // success  
        //$state.go('') 
        Toast.show('inAppBrowser success', 'short', 'bottom'); 

       }).catch(function (event) { // error 
        Toast.show('Error opening site', 'short', 'bottom'); 
       }); 
      $rootScope.$on('$cordovaInAppBrowser:exit', function (e, event) { 
       Toast.show('inAppBrowser exit', 'short', 'bottom'); 
      });