The latest version of Cordova 3 or above now supports the splash screen, which is implemented through the cordova plug-in.
Currently, the Splash plug-in supports multiple platforms such as android, ios, and blackberry.
The process of adding plug-ins is as follows:
Run in the cordova project directory:
cordova plugin add org.apache.cordova.splashscreen
<preference name="SplashScreen" value="screen" /> <!-- 不带后缀png的文件名,默认是screen--> <preference name="SplashScreenDelay" value="3000" /> <!-- Splash显示时间,默认是3000ms--> <feature name="SplashScreen"> <param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" /> </feature>
document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { navigator.splashscreen.hide(); }
navigator.splashscreen.hide();
.
Now run your App and you should see the splash screen.