I'm looking for different Chrome apps to make my pages darker/inverted to reduce eye strain, I found some apps that work but the only thing left, which these apps doesn't seem to override, is the White Blank page.
When a new page is loaded, Chrome first displays a White Blank page, while the page is loading then displays the website's content. Is there a way to override this While page to say Black? At the moment, everytime I click on a link or open a new webpage, the screen goes from darkcoloured (through inverted/darkening page apps) to the White Blank screen for a brief second then the new page loads in a dark colour again. This acts like a "White Flash" by the screen everytime a new page is loaded and causes further eye strain. This is why I want to know if there is a way to override this White colour to Black.
Ps. If this post is in the wrong forum, I apologise, Google Chrome Developers page had a link to Forums which brought me here :)
Thanks.
manifest.json
{
"name": "Background",
"permissions" : ["http://*/*", "https://*/*"],
"version": "1.0",
"content_scripts": [{
"matches": ["http://*/*", "https://*/*"],
"js": ["script.js"],
"all_frames": false,
"run_at": "document_start"
}],
"manifest_version": 2
}
script.js
var color = document.documentElement.style.backgroundColor;
document.documentElement.style.backgroundColor = "black";
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.target.nodeName == "BODY") {
observer.disconnect();
document.documentElement.style.backgroundColor = color || "";
}
});
});
observer.observe(document, { childList: true, subtree: true });
Put all of the files in a folder. In chrome, go to Settings -> Extensions -> turn on Developer Mode -> Load unpacked extension -> Choose the folder you just created.
来源:https://stackoverflow.com/questions/16243105/google-chrome-override-white-blank-page-between-webpage-loads