0

Flarum是一款新時代的論壇軟件,它擁有一款出色的移動網絡應用程序,可在iOS/Android的Chrome瀏覽器中工作得非常出色。它有很多功能,如滑動討論,攻擊等答覆等將外部手機網站加載到Ionic的InAppBrowser中

我的目標是加載從Ionic混合應用程序相同的移動Web應用程序。我嘗試從iFrame加載移動web應用程序的第一件事。這造成了很多問題。最初這個頁面甚至不會滾動,只有在幾次認真的google-fu之後才能讓滾動工作,那也是非常不穩定的。

然後我開始看ngCordova的InAppBrowser。問題是我似乎無法獲得與在iOS/Android中從Chrome加載它相同的功能。滾動工作正常,但其他功能缺失,即滑動討論和其他許多事情。

這是Ionic/ngCordova中的限制,還是我應該看一下?我已經看過文檔,並按照here的步驟

任何提示,指針或示例應用程序將不勝感激。謝謝 !

tl; dr:我想從Ionic ngCordova的InAppBrowser加載一個移動網站,但可以獲得與從移動設備上的chrome/safari加載它相同的功能。

回答

1

JS

window.open(‘http://example.com’, ‘_system’); //Loads in the system browser 
window.open(‘http://example.com’, ‘_blank’); //Loads in the InAppBrowser 
window.open(‘http://example.com’, ‘_blank’, ‘location=no’); //Loads in the InAppBrowser with no location bar 
window.open(‘http://example.com’, ‘_self’); //Loads in the Cordova web view 

HTML

<ion-view title="Test Page"> 
    <ion-content> 
     <div class="list"> 
      <a class="item" href="#" onclick="window.open('http://www.nraboy.com/contact', '_system', 'location=yes'); return false;"> 
       Open a Browser 
      </a> 
      <a class="item" href="#" onclick="window.open('http://www.twitter.com/nraboy', '_system', 'location=yes'); return false;"> 
       Open a Twitter Client or Browser 
      </a> 
      <a class="item" href="#" onclick="window.open('https://plus.google.com/+NicRaboy', '_system', 'location=yes'); return false;"> 
       Open a Google+ Client or Browser 
      </a> 
     </div> 
    </ion-content> 
</ion-view> 

來源https://www.thepolyglotdeveloper.com/2014/07/launch-external-urls-ionicframework/

+0

拉吉嗨,感謝您的努力。當我四處尋找答案時,我遇到了這個問題。不幸的是,這似乎不能解決問題,儘管我再次嘗試了這一點。沒有得到它在iOS模擬器或我的手機上工作。 我覺得解決方案可能(可能)與ngCordova(Ionic實現Cordova的庫)有關。 –

+0

是的,你將不得不包括ngcordova.js –