1

我無法延遲iOS和Android上的啓動畫面,並且只能在InAppBroswer完成時將其刪除。這是我試圖在InAppBroswer加載完成後隱藏splashscreen

的config.xml

<preference name="splashScreenDelay" value="10000" /> 
<preference name="AutoHideSplashScreen" value="false" /> 

的index.html

<html> 
<head> 
<title>Example App</title> 
<meta charset="utf-8"> 
<link href="css/index.css" rel="stylesheet" type="text/css"> 
</head> 


<script src="cordova.js" type="text/javascript" ></script> 
<script src="js/main.js" type="text/javascript"></script> 
<script type="text/javascript" charset="utf-8"> 

// Wait for device API libraries to load 
// 
document.addEventListener("deviceready", onDeviceReady, false); 

// Global InAppBrowser reference 
var iabRef = null; 


function onDeviceReady() { 
iabRef = window.open('https://www.example.com/app', '_self', 'location=no,toolbar=no'); 

iabRef.addEventListener('loadstop', function() { 
    navigator.splashscreen.hide(); 
}); 

document.addEventListener("backbutton", function (e) { 
e.preventDefault(); 
}, false); 
} 
</script> 
<body> 
<iframe src="https://www.example.com/app" style="width:100%; height:100%;"> 
</body> 
</html> 

的濺射屏幕示出了用於一秒鐘,然後一個whitescreen邏輯約5秒鐘。

索引中的邏輯是在inAppBroswer完成加載後隱藏splashscreen(loadstop),但這似乎不起作用。

任何想法請。

的console.log(領航員)

enter image description here

回答

0

Inappbrowser有所回調後,頁面加載完成。

閱讀documentation。見addEventListener

這可能是這樣的:

ref.addEventListener('loadstop', function() { 
    navigator.splashscreen.hide(); 
}); 
+0

是navigator.splashscreen.hide();意味着返回真或假?你有什麼想法,因爲當我嘗試提醒或控制檯登錄時。我得到undefined請看看問題console.log(導航器)顯示'splashscreen' – PHPnoob

+0

'navigator.splashscreen.hide();'返回既不是真或假,如果任何東西它會返回''undefined'' - 這是麻煩的。本文將幫助[Truthy和Falsy:當所有不等於JavaScript](http://www.sitepoint.com/javascript-truthy-falsy/) – JesseMonroy650

+0

感謝文章只是提醒我爲什麼我不喜歡JavaScript非常許多。爲什麼讓我質疑手頭上的問題。如果'navigator.splashscreen.hide()'既不返回true也不false,那麼你如何知道它的工作與否? – PHPnoob

-1

他們似乎做的最新的更新啓動畫面中的錯誤,看來你不能設置AutoHideSplashScreenfalse,然後使用SplashScreenDelay在同時

似乎工作正常,因爲那作品navigator.splashscreen.hide();作品也我認爲