如何在不使用iFrame的离子应用程序中显示网站?

时间:2019-02-01 09:23:36

标签: cordova ionic-framework iframe ionic4

我环顾了很长时间,但找不到任何有效的方法。

我指的是此问题:here-将网站嵌入您的离子应用程序中。不幸的是,使用iframe的建议解决方案不适用于所有页面,因为许多网站都已阻止iframe,如下图所示。

我已经尝试了运行良好的InAppBrowser插件。但是它会打开一个全屏并隐藏我的应用程序导航。您必须关闭屏幕才能返回到应用程序。那不是我真正想要的。我的InAppBrowserOptions是:

options : InAppBrowserOptions = {
    location : 'yes',
    hidden : 'no', 
    clearcache : 'yes',
    clearsessioncache : 'yes',
    zoom : 'yes',
    hardwareback : 'yes',
    mediaPlaybackRequiresUserAction : 'no',
    shouldPauseOnSuspend : 'no', 
    closebuttoncaption : 'Close', 
    disallowoverscroll : 'no', 
    toolbar : 'yes', 
    enableViewportScale : 'no', 
    allowInlineMediaPlayback : 'no',
    presentationstyle : 'pagesheet',
    fullscreen : 'yes',
    hideurlbar : 'yes',
    hidenavigationbuttons : 'yes',
};

是否有更好的方法将网站嵌入到应用程序中?

enter image description here

1 个答案:

答案 0 :(得分:0)

尽管我认为InAppBrowser是最好的。您可以自定义其设置以显示导航栏。我坚持要求您使用InAppBrowser

现在开始使用iframe替代方法,您可以使用embedobject。但这在某些情况下也不起作用。

要自定义InAppBrowser,请访问此link.,您还可以找到大量与此相关的教程。

我希望这会有所帮助!谢谢!