Phonegap Build ios 6 iphone 5不会消失

时间:2013-03-10 19:31:52

标签: android jquery ios cordova phonegap-build

嘿所有我已经创建了一个Android / iphone应用程序,在Android上工作得很好但由于某种原因它只是显示启动画面/加载动画而不是过去那个。

以下是屏幕的样子:

enter image description here

在我的config.xml文件中我有:

<!--App settings -->
    <preference name="phonegap-version"                                     value="2.3.0" />
    <preference name="orientation"                                          value="portrait" />
    <preference name="fullscreen"                                           value="true" />
    <preference name="exit-on-suspend"                                      value="true" />
    <preference name="auto-hide-splash-screen"                              value="false" />
    <preference name="splash-screen-duration"                               value="10000" />
    <preference name="webviewbounce"                                        value="true" />

在我的javascript中我有:

    //Wait for device
    function onDeviceReady() {
        navigator.splashscreen.hide();
    }

    document.addEventListener("deviceready", onDeviceReady, false);

但是,我将此代码用于index.html文件:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=310;" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title></title>
</head>

<body>
<script>
    window.location='https://fb.zzzzzzz.com/xxxxxx/index.php';
</script>
</body>
</html>

我缺少什么设置?可能是因为我在.html之后调用.php页面吗?

1 个答案:

答案 0 :(得分:0)

在触发并处理设备就绪事件后,它适用于我。

的JavaScript

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 explicity call 'app.receivedEvent(...);'
    onDeviceReady: function() {
        app.receivedEvent('deviceready');
    },
    // Update DOM on a Received Event
    receivedEvent: function(id) {
        var parentElement = document.getElementById(id);
        var listeningElement = parentElement.querySelector('.listening');
        var receivedElement = parentElement.querySelector('.received');

        listeningElement.setAttribute('style', 'display:none;');
        receivedElement.setAttribute('style', 'display:block;');

        console.log('Received Event: ' + id);
        window.location='https://fb.zzzzzzz.com/xxxxxx/index.php';
    }
};

HTML

<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
    app.initialize();
</script>