Google Chrome - Override White Blank page between webpage loads [closed]

我们两清 提交于 2019-11-28 15:53:43

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!