Apache Cordova load external URL or website inside div

本秂侑毒 提交于 2021-02-08 07:59:24

问题


I am loading Website inside App using cordova.InAppBrowser.open('example.com', '_self', 'location=no,clearsessioncache=yes') and everything is works fine i.e it shows complete website mobile view inside the app, but now I am using some navigation inside assets\www\index.html file and when user will click on link the navaigation I want to load the website inside the div OR without losing the navigation.

function load_web(URL)
        {
            cordova.InAppBrowser.open(URL, '_self', 'location=no,clearsessioncache=yes');
        }
<a href="javascript:load_web('example1.com')" >Web 1</a>
<a href="javascript:load_web('example2.com')" >Web 2</a>


回答1:


In other words, you want to show a non-fullscreen external site using Cordova's InAppBrowser. You can't do this, as it will always cover the entire app window. You have to use iframes for this, but this may or may not cause your app to be rejected by the store.

Notice that iframes and InAppBrowsers are becoming more and more restricted and eventually, Google and Apple could simply delete all apps using iframes and InAppBrowsers for the so-called security concerns paranoia. (and I wouldn't blame them, for the ill-use of iframes that we see everywhere)



来源:https://stackoverflow.com/questions/50306068/apache-cordova-load-external-url-or-website-inside-div

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!