-
Notifications
You must be signed in to change notification settings - Fork 633
Open
Labels
Description
Bug Report
It looks like the code is executed to fast, when running in a browser, so when the show-function is called, then document.body is still null, thus giving a javascript error
Problem
No splashscreen
What is expected to happen?
Splashscreen should be shown in browser
What does actually happen?
document.body.appendChild(localSplash); returns exception as document.body is still null
Information
Just waiting 200 ms before appending the splashscreen, like this
window.setTimeout(function () {
if (document.body) {
document.body.appendChild(localSplash);
}
}, 200);
seems to fix the problem
Another idea might also be to make the hide more robust by adding a check before removing the child like this
window.setTimeout(function () {
console.log("Removing splash: " + innerLocalSplash);
if (innerLocalSplash && innerLocalSplash.parentNode == document.body) {
document.body.removeChild(innerLocalSplash);
}
innerLocalSplash = null;
}, 1000);
Command or Code
Requires a fast computer, and I have seen it on the latest version of Chrome
Environment, Platform, Device
Chrome
Version information
Using cordova-plugin-splashscreen 5.0.3
Checklist
- I searched for existing GitHub issues
- I updated all Cordova tooling to most recent version
- I included all the necessary information above