使用inappbrowser您可以创建一个命令科尔多瓦的移动app.Simply安装inappbrowser插件里面你的网站的网页视图。
cordova plugin add cordova-plugin-inappbrowser --save
var app = {
// Application Constructor
initialize: function() {
this.bindEvents();
},
// Bind Event Listeners
//
// Bind any events that are required on startup. Common events are:
// 'load', 'deviceready', 'offline', and 'online'.
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
// deviceready Event Handler
//
// The scope of 'this' is the event. In order to call the 'receivedEvent'
// function, we must explicitly call 'app.receivedEvent(...);'
onDeviceReady: function() {
// app.receivedEvent('deviceready');
var element=document.getElementById('status-message');
console.log(element);
var ref = cordova.InAppBrowser.open('url', '_blank', 'location=no');
ref.addEventListener('loadstart', function(event) {
element.innerHTML="Please Wait App is loading....." ;
});
}
};
另一个建议是不加载你的网站为主要出发文件。由于phonegap需要大量文件,因此首页显示可能需要很长时间。我会使用正常的本地index.html和它在deviceready上,加载您的网站与top.location.href = ...我所做的是一个加载程序页面上启动一个进度条,使用Ajax加载每个JS和CSS文件的网站需要。从那时起,所有内容都被缓存,所有页面加载速度都很快。 –