将Cordova与现有的WebApp一起使用



我想从科尔多瓦(Cordova)的烧瓶服务器中动态生成的HTML。我搜索了答案,其中很多建议在index.html文件中进行类似的操作。

<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<meta charset="utf-8">
<script type="text/javascript" charset="utf-8" src="cordova-2.1.0.js"></script>
<script type="text/javascript">
     function onBodyLoad(){     
        document.addEventListener("deviceready", onDeviceReady, false);
     }
     function onDeviceReady(){
         window.location.href = <your_remote_url>
     }
}
</script>

可悲的是,这不起作用,并在设备的本机浏览器中打开页面。还有另一个工作吗?预先感谢。

在应用程序浏览器中使用Cordova。

这将打开应用本身中的页面。

安装

cordova plugin add https://github.com/apache/cordova-plugin-inappbrowser

如何使用检查..

https://github.com/apache/cordova-plugin-inappbrowser#sample

如果安装另一个插件感到不舒服,请尝试在应用程序中显示WebView。

<div style="height: 100vh;">
  <iframe src="http://google.com" style="border: 0; height: 100vh; width:100%"></iframe>
</div>

最新更新