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();作品也我认为