there are more than one page in my project,when i use location.href=“xxx.html” switch page,there will be a flash of white screen.how do I avoid this white screen?
Actually, you can’t avoid that. You’re effectively loading another page, just like in a web browser. And in web browsers, when you’re going to load another page, the current one has to be unpainted. That’s why you get the flash of white. It’s your page being unpainted so the next one can be loaded.
If it’s really a big deal (for my app it was), you can look into Single Page Applications, which are actually very suitable for Electron. And given it’s nature, many problems with SPAs like navigation aren’t present in Electron because it doesn’t use traditional browser controls.
You can use window.location.assign(‘xxx.html’) instead of location.href=xxx.html
I tested it, but it still has a white screen.
for me window.location.assign() is working thanq fellahss