Is it possible to load an external website inside a Cordova mobile app on Windows?

喜夏-厌秋 提交于 2019-12-06 04:48:17

You can use org.apache.cordova.inappbrowser to open web page like var ref = window.open('http://apache.org', '_blank', 'location=yes');

The only way I have found that works is by creating an iFrame or x-ms-webview to load the remote content in. This is essentially what InAppBrowser does for you. However, my problem was that I want the remote content to be able to call Cordova APIs. To accomplish this, I use pass messages back and forth between the webview and the parent local page that has access to APIs. I do this with the MSWebViewScriptNotify event on the webview and the invokeScriptAsync method as described in this article: http://blogs.windows.com/buildingapps/2013/10/01/blending-apps-and-sites-with-the-html-x-ms-webview/

Use this in a click event and before that install InAppBrowser in your app

var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=no');

This will exactly like you want

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