在没有连接或离线时尝试在phonegap上获得双重定向,但屏幕保持空白
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function onDeviceReady() {
InternetOK();
}
function InternetOK() {
var networkState = navigator.connection.type;
if (networkState == Connection.NONE ){
window.location = 'offline.html';
} else {
window.location = 'app.html';
}
document.addEventListener("deviceready", onDeviceReady, false);
</script>
</head>
<body>
</body>
</html>
答案 0 :(得分:0)
请在cordova.js
代码
<head>
<script src="cordova.js"></script>