2015-10-01 84 views
0

其實我正在做一個Cordova項目,我將打開一個包含圖像的外部鏈接,所以在看到該圖像後,我的問題是什麼我將他重定向迴應用程序。以便他可以瀏覽應用程序。如何在ios應用程序中打開外部URL鏈接返回到應用程序

任何解決方案對此將不勝感激。

+0

怎麼樣使用['InAppBrowser'](https://cordova.apache.org/docs/en/3.0.0/cordova_inappbrowser_inappbrowser.md.html) – Rayon

+0

我不知道它是否在InAppBrowser中打開或不顯示圖像。點擊一些圖標 – kiran

回答

0

您應該爲此使用InAppBrowser plugin。您可以覆蓋默認的鏈接行爲,該鏈接行爲可以通過鏈接的內容接管整個應用程序的Web視圖,而無需返回應用程序。你可以這樣做這樣的事情(找到一個div各個環節,與應用程序和InAppBrowser(這個用了jQuery,但你的想法)之間轉換時的InAppBrowser加入了翻轉動畫打開它們:

amendLinks : function (selector) { 
    $(selector).find('a').each(
     function() { 
      var href = $(this).attr('href'); 
      var iabOptions = (device.platform === 'iOS' ? 'location=no,enableViewportScale=yes,transitionstyle=fliphorizontal' : ''); 

      if (href.indexOf('http') === 0) { 
       $(this).click(function(e) { 
        e.preventDefault(); 
        cordova.InAppBrowser.open(''.concat(this.href), '_blank', iabOptions); 
       }); 
      } 
     } 
    );  
} 
相關問題