将cordova与现有webapp一起使用

将cordova与现有webapp一起使用,cordova,ionic-framework,phonegap-build,Cordova,Ionic Framework,Phonegap Build,我想在cordova中显示从flask服务器动态生成的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

我想在cordova中显示从flask服务器动态生成的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>

函数onBodyLoad(){
文件。添加的监听器(“deviceready”,OnDeviceraddy,false);
}
函数ondevicerady(){
window.location.href=
}
}

遗憾的是,这不起作用,并在设备的本机浏览器中打开页面。还有别的工作吗?提前感谢。

在应用程序浏览器中使用cordova

这将在应用程序本身中打开页面

安装

cordova plugin add https://github.com/apache/cordova-plugin-inappbrowser
如何使用支票

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

如果您在安装另一个插件时感到不舒服, 请尝试iframe在应用程序中显示网络视图。 大概

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


您是否有理由不想使用上述插件(资源、速度、兼容性)?恕不冒犯。但根据我的经验,由于性能、兼容性、权限等原因,插件越少越好。同样的想法也适用于Java脚本。(显然)