I would like to apply custom CSS to pages in Chrome, but before the extensions are loaded.

I'm already familiar with this solution: Applying custom style to internal Chrome pages

But I need to apply the styles while the page is still being loaded, before extensions kick in. Chrome's Custom.css used to work for that, but now it was removed. I'm looking for a hack to do this.

(The reason I want this so much is that my custom styles invert the page, showing white-on-black rather than black-on-white, but every time there's a page load it blasts my eyes with a screen full of white until the extension kicks in. I want to prevent this and maintain my eyesight.)

Bonus points if you can show me how to style the new tab page, and pages loaded from the computer itself (like local HTML files), so I could invert those as well.

  • Some extensions that might help : Hacker Vision and High Contrast. – harrymc Mar 27 '14 at 20:58
  • 1
    Would a solution at the operating system level, rather than for just Chrome, be acceptable? – Jason Aller Mar 27 '14 at 22:05
  • I think so. (I use Windows 7). Of course, I'd need to see the solution to really judge whether it's satisfactory. – Ram Rachum Mar 28 '14 at 12:42
  • Two more : Night Reading Mode and Invert Page Colors. – harrymc Mar 28 '14 at 14:26
  • @harrymc Tried them both now, didn't help. (No surprise given that they're extensions, it seems extensions kick in only after the page has loaded some.) – Ram Rachum Mar 28 '14 at 17:34

Temporary workaround

A short-term workaround could be to downgrade Chrome to an earlier version. Be aware that:

  • Google only supports the most current stable channel release.
  • Chrome will try to update itself automatically, and you need to prevent that.
  • You will miss any security updates, bug fixes, or new features.

In the long run, you will be stuck with an old, outdated browser. The single feature you're missing might have been brought back in the meanwhile, or not. As a backup plan, playing with a different browser is worth the effort, even if you don't plan to switch right away.

File information

Considering Google won't endorse old Chrome versions, you have to rely on third parties who can provide a standalone, offline installer. Any web installer would automatically retrieve the most updated version, thus making it totally useless.

The latest stable version released in the 31.x branch is 31.0.1650.63. Here are the basic details and hashes of the official installer:

File:    31.0.1650.63_chrome_installer.exe
Size:    33.7 MiB (35337056 bytes)
Version: 31.0.1650.63
CRC32:   14b5a4cf
MD5:     8d8e67e5a438e9906cc90c5ed4aa1ad7
SHA1:    a022ceeb5523145efbcf50c30426b8f2cec33716
SHA256:  2aaee6f9da598b483833e541ed8cc1671e3f034624834ad9c5ed1decedafa5a4

Additionally, the file is digitally signed by Google Inc, and countersigned by Symantec Time Stamping Services Signer - G4. Both signatures must be valid. You can check them by opening the file properties dialog.

For newer or older Chrome versions, here's a reliable (albeit unofficial) page containing the details about each installer: Chrome Installer Information.

Download links

You can use any of the link below, or find an alternate source yourself. While the actual file name could be different, the other details provided above must match exactly.

Make sure to scan the files using your antivirus, and upload a copy to VirusTotal to feel confident enough. If possible, test the program in a safe environment first. When you're done, make a backup of the setup executable.

Prevent updates

  1. Make sure all Chrome-related processes are completely closed, then open an elevated command prompt. Type or paste the following commands to disable the auto-update features via the registry:

    reg add "HKLM\SOFTWARE\Policies\Google\Update" /v "UpdateDefault" /t REG_DWORD /d 0 /f
    reg add "HKLM\SOFTWARE\Policies\Google\Update" /v "AutoUpdateCheckPeriodMinutes" /t REG_DWORD /d 0 /f
    reg add "HKLM\SOFTWARE\Policies\Google\Update" /v "DisableAutoUpdateChecksCheckboxValue" /t REG_DWORD /d 1 /f
    reg add "HKLM\SOFTWARE\Policies\Google\Update" /v "Update{8A69D345-D564-463C-AFF1-A69D9E530F96}" /t REG_DWORD /d 0 /f
  2. Disable (but not delete) all Google Update scheduled tasks and services:

    for /r "%windir%\System32\Tasks" %A in ("GoogleUpdate*") do @schtasks /change /tn "%~nA" /disable
    for /f "delims=" %A in ('"reg query "HKLM\SYSTEM\CurrentControlSet\Services" | findstr /i /c:"gupdate" "') do @sc stop "%~nA" & @sc config "%~nA" start= disabled

    As pointed out by @Synetech, you should avoid deleting the Google Update tasks "because Chrome will simply re-create them the next time you run it; it will not re-enable them if they already exist but are disabled." I wouldn't recommend deleting them anyway, should you want to enable them in the future.

  3. Prevent the GoogleUpdate.exe application from running:

    reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\GoogleUpdate.exe" /v "Debugger" /t REG_SZ /d "systray.exe" /f

    If you're interested in how that works exactly, check this question: How to block programs from running (Windows 7).

  4. Type chrome:plugins in the Chrome address bar, and disable the Google Update plug-in.

Reverting back

In case you want to enable updates again, follow the steps below.

  1. Make sure all Chrome-related processes are completely closed, then open a command prompt as administrator. Type or paste the following commands:

    reg delete "HKLM\SOFTWARE\Policies\Google\Update" /f
    reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\GoogleUpdate.exe" /f
    for /r "%windir%\System32\Tasks" %A in ("GoogleUpdate*") do @schtasks /change /tn "%~nA" /enable
    for /f "delims=" %A in ('"reg query "HKLM\SYSTEM\CurrentControlSet\Services" | findstr /i /c:"gupdate" "') do @sc config "%~nA" start= demand
  2. Type chrome:plugins in the Chrome address bar, and enable the Google Update plug-in.

  • Using an older version is a security risk, given the latest zero-day exploits. – harrymc Apr 2 '14 at 11:54
  • 1
    Hardly; using a (slightly) older version as temporary workaround is no more a security risk than using XP or outdated virus-defs or anything else. With even a modicum of good sense, you can be quite safe. There are plenty of articles about living perfectly securely without any kind of anti-virus running in the background. By avoiding risky behavior and using a few simply tricks like a router with a built-in firewall, you can easily continue to use this an older version and be perfectly safe for a few months until you can figure out a long-term solution like switching to another browser. – Synetech Apr 2 '14 at 21:34
  • 2. Disable all Google Update scheduled tasks and services… I should point out that you must only disable the Google Update tasks, do not delete them because Chrome will simply re-create them the next time you run it; it will not re-enable them if they already exist but are disabled. (At least that’s true of versions up to at least 28; I can’t vouch for newer versions which may indeed re-enable the tasks if they are disabled.) – Synetech Apr 2 '14 at 21:35
  • @Synetech I tried deleting the tasks on purpose, but they weren't created again. I have to add I was using Chrome version 33.0.1750.154 on Windows 7 though; your mileage may vary. Still, I think just disabling the tasks is better because they can be easily restored if needed. | @RamRachum I've updated my answer to prevent the GoogleUpdate.exe process from running at all, even if the related tasks or services were to become enabled against your will. I've also provide undo steps in order to re-enable updates, just in case. – and31415 Apr 3 '14 at 10:56
  • Maybe they changed it in a version after I first noticed it re-creating them. Or maybe they exist on your system now. Just don’t go to chrome://about or it will almost certainly re-create them (even if GoogleUpdate.exe can’t run). – Synetech Apr 5 '14 at 16:51

This is a known bug :
Issue 1373: Navigating dark background websites results in blinding white flashes between pages,
is a very very long thread starting on Sep 4, 2008 !

The bug was "fixed" several times, but the fixes were either not effective or had to be pulled because they caused other problems or inefficiencies. Numerous other bug issues were merged into this one bug, many users have declared abandoning Chrome because of it, but the bug is not closed yet.

The analysis of the bug seems to be that if the displayed page does not start with an <body> HTML tag that contains a background color, and if rendering the page takes more than a few hundreds of a second, the page will be displayed with a white background. This can happen, for example, if the source website is too slow or the page is very large or is written inefficiently (for example with large images that take a long time to download).

The last two messages in the issue say :

On May 23, 2013 :

OK, looks like that stuck. This should be solved in a canary soon, and in the 29 release. If you still see it happening, file new bugs.

And on Jun 5, 2013 :

Issue 247003 has been merged into this issue.

The bug seems to have been forgotten since then - no new entries.

So it seems that in spite of the optimistic before-last message, the bug is still alive and kicking. After so many people have searched in vain for a solution or a workaround, I believe that the only solution is for the bug to be fixed in Chrome.

The only advice I can give is to keep on pushing on the Chrome developers to fix the bug. But after more than five years, it seems that for some reason its solution is very difficult to achieve.

  • 1
    I disagree with equating my question with solving this bug. In previous versions of Chrome I was happy, because I defined a rule in Custom.css that made the interim period between sites black. So, if only we could hack something with functionality like Custom.css, the problem would be solved. – Ram Rachum Mar 28 '14 at 23:50
  • Unfortunately the developers have decided to eliminate Custom.css, so your problem is not the only one currently without solution. I have taken part here in two other threads where the only conclusion was to abandon Chrome. The Custom.css thing is rather recent (November 2013), but I don't believe that the developers will go back. My own idea is that some modules in Chrome were so badly programmed that the developers in self defense are now cutting them out as impossible to fix. Someone will have to volunteer to rewrite it from scratch, but this isn't going to happen soon. – harrymc Mar 29 '14 at 7:35
  • You could also try this solution, which might shorten the white flash. – harrymc Mar 29 '14 at 15:18
  • 1
    Thanks for the reference. I tried it but that extension only kicks in when Hacker Vision does, so it doesn't help. – Ram Rachum Mar 29 '14 at 23:58
  • 1
    @RamRachum, also, I just noticed that the flashbang bug (and consequently your problem as well now that user stylesheet support has been abandoned—despite their support and use in every single other browser since the beginning of time) has actually been a bug in Chrome since, quite literally, the very first version ever released. I can’t help but wonder what business those people have making a browser at all; they clearly don’t have the requisite skills if they have so much trouble and struggle so hard doing and getting even basic things right that other browser could forever. ¬_¬ – Synetech Mar 30 '14 at 21:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.