【问题标题】:Loading an external mobile website into Ionic's InAppBrowser将外部移动网站加载到 Ionic 的 InAppBrowser
【发布时间】:2016-04-23 06:00:57
【问题描述】:

Flarum 是一个新时代的论坛软件,它有一个出色的移动网络应用程序,在 iOS/Android 的 chrome 上运行得非常好。它有很多功能,例如滑动讨论、点击回复等。

我的目标是从 Ionic 混合应用加载相同的移动网络应用。我尝试从 iFrame 加载移动 Web 应用程序的第一件事。这引起了很多问题。最初页面甚至不会滚动,只有经过几次严肃的 google-fu 后,我才能让滚动工作,这也很不稳定。

然后我开始研究 ngCordova 的 InAppBrowser。问题是我似乎无法获得与从 iOS/Android 中的 Chrome 加载相同的功能。滚动工作正常,但缺少其他功能,即滑动讨论和许多其他功能。

这是 Ionic/ngCordova 中的限制,还是我应该看看什么?我查看了文档并按照here

中的步骤进行操作

任何提示、指针或示例应用程序将不胜感激。谢谢 !

tl;dr:我想从 Ionic ngCordova 的 InAppBrowser 加载移动网站,但可以获得与从移动设备上的 chrome/safari 加载相同的功能。

【问题讨论】:

    标签: ionic-framework hybrid-mobile-app inappbrowser ngcordova


    【解决方案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/

    【讨论】:

    • 您好 Raj,感谢您的努力。当我四处寻找答案时,我确实遇到了这个问题。不幸的是,这似乎并没有解决问题,尽管我确实再次尝试过。没有让它在 iOS 模拟器或我的手机上工作。我觉得解决方案(可能)与 ngCordova 有关,它是 Ionic 对 Cordova 库的实现。
    • 是的,你必须包含 ngcordova.js
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-31
    • 2011-09-13
    • 1970-01-01
    • 1970-01-01
    • 2013-02-08
    相关资源
    最近更新 更多