Prevent white screen before loading page in chromium?

61,323

Solution 1

Nice workaround vasa1, the white flashes are gone. But the background of some websites turns black, which is a bit ugly:

enter image description here

So I adapted that CSS and ended up with:

html:not(:hover), body:not(:hover){
    background-color:#000000;
}

This means that when the cursor is not over the page, the background is set to black - when you click on the new tab button, the cursor is not over the page, so a black background will flash instead of a white one. When you hover the cursor over the page (when you're reading it) the black background is then forgotten, and the website's one is used instead:

enter image description here enter image description here

Solution 2

For Google Chrome and Chromium, you are probably a victim of Issue 1373: Navigating dark background websites results in blinding white flashes between pages.

There's a hack to minimize, but not totally eliminate, your misery described in comment 261:

As a temporary fix, I set the custom user stylesheet to render pages with a black background so that before it receives styling information from the website it renders the window black instead of white, and now it flashes black instead, which is much more bearable on the eyes until a permanent solution is made.

The hack involves adding the following lines to your Custom.css which is located in User Stylesheets in your Default folder. In my case, the path is ~/.config/chromium/Default/User Stylesheets.

html, body{
background-color:#000000; //This sets the background color to black
color:#0000FF; //This sets the text to blue, so you can read it on webpages set to use defaults; white is too hard on my eyes and if you dont put this it will be black on black
}

As for Firefox, I use the following code in userChrome.css located in ~/.mozilla/firefox/profile_name/chrome:

@namespace xul url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);

/*prevent white flash*/
tabbrowser tabpanels { background-color: #111 !important}

If the chrome folder doesn't exist, create it. Note that both chrome and userChrome.css are case-sensitive.

Solution 3

As far as I know, all of the old methods that fixed this bug no longer work (in 2016). I came up with a solution today to overcome this issue and wrote about it some which is available here: http://jollo.org/LNT/public/chrome-white-flash.html .

It essentially makes use of an autohotkey script that paints the window onto itself until the next page has loaded, by-passing the period in which the window flashes.

Solution 4

UPDATE: I've changed my answer to use temporary dimming of screen as my previous solution was buggy and left the browser scroll state broken.

This solution uses an automator script set up as a service made available to Chrome and finally mapped to a keyboard shortcut in system. The simple solution was to just dim the screen about 5x worked for me but you might wanna play with that sending depending on your brightness. If you use a very dark setting for example, the screen my go completely blank for a second, but that still better than the blaring flash of white.

See https://gist.github.com/lacostenycoder/01108de10fe02e2f39d9cceb2457b895

on run {input, parameters}

    set the_application to (path to frontmost application as Unicode text)

  repeat 5 times
    tell application "System Events"
          key code 107
      end tell
  end repeat
  delay 1

    tell application "System Events"

    keystroke "t" using command down
    delay 1

    end tell
  delay 1 
  repeat 5 times
    tell application "System Events"
          key code 113
      end tell
  end repeat

    return input
end run

Solution 5

Installing this Dask Theme eliminated the white screen flash for me on Windows 10. https://chrome.google.com/webstore/detail/macos-mojave-dark-mode/emoadoophllahfgbjaidlhjgnnmmdigh?hl=en

Share:
61,323

Related videos on Youtube

Alex
Author by

Alex

Updated on September 18, 2022

Comments

  • Alex
    Alex almost 2 years

    When a page doesn't load immediately, Chromium and every other browser I tried display a white screen before they get a response from it:

    enter image description here

    Even though chrome://settings/personal says it's using the GTK+ theme - in my case it's Darklooks, which has a dark background:

    enter image description here

    Is there a way to avoid this in Chromium? Or, if there isn't, is there a browser that does not have this "issue"?

    • Greg
      Greg over 10 years
      Your page looks really blurry too!
    • Mateen Ulhaq
      Mateen Ulhaq about 10 years
      For Firefox, you can change the value of browser.display.background_color to a darker color (#333). Also try adding browser { background-color: #333 !important; } and tabbrowser tabpanels { background-color: #333 !important} into userChrome.css.
    • Admin
      Admin almost 10 years
      this hack solved white flash for me. stackoverflow.com/questions/16243105/…
    • wp78de
      wp78de over 5 years
      I simply installed the dark incognito theme chrome.google.com/webstore/detail/material-incognito-dark-t/‌​… this solved the issue for me: No white page on page load anymore!
  • Mist
    Mist about 11 years
    Great! See if you can add it to the list of comments there (issue1373). I suspect you may not because they seem to have restricted comments: Only users with EditIssue permission may comment. :(
  • Mist
    Mist about 11 years
    And when I tested Midori (also WebKit) a year ago, it didn't flash white! I don't know how it is now. I left Midori because it wasn't as customizable and crashed (for me) or some important pages.
  • LifeInTheTrees
    LifeInTheTrees over 10 years
    I re-installed chrome and now the fix doesnt work anymore, i still have "user stylesheets/custom.css" file that worked previous to the install, but it's flashing white and history page is white again. anyone know why?
  • holocronweaver
    holocronweaver almost 9 years
    Chromium solution did not work for me in 2015, but Firefox solution mostly does. Can't completely avoid flickering due to browsers incrementally loading pages.
  • ecoe
    ecoe about 8 years
    this approach no longer works as of 2016
  • hbt
    hbt over 7 years
    another hack by forking the source code here github.com/hbtlabs/chromium-white-flash-fix
  • wotter
    wotter over 5 years
    firefox method does not work for me (ubuntu 18.04+ ffox 65.0.1)
  • AMS777
    AMS777 over 3 years
    What better works for me on Firefox 86 is browser, .browserContainer { background-color: black !important; } in userChrome.css.
  • jeyko
    jeyko over 3 years
    amazing, this actually worked! can't believe noone mentioned this!
  • Mugé
    Mugé almost 3 years
    It was that the html page I was loading in Wordpress, Elementor, where my slider is manually designed, was loading white. Your answer of putting black background to html did solve my problem fantastically. Thank you!
  • tinker
    tinker almost 3 years
    all doesn't work on Firefox 91
  • Murshid Ahmed
    Murshid Ahmed almost 3 years
    In 2015 Chrome dropped support for user style sheets: this recipe won't work for Chrome