I currently have the following code set up:
style.js
:
function applyStyle(str) {
var element = document.createElement('style');
element.innerHTML = str;
document.body.appendChild(element);
}
var style = 'body {'
style += ' color: red;'
style += '}'
applyStyle(style);
and configuration.json
:
{
"name": "example",
"description": "example description",
"manifest_version": 2,
"version": "1.0",
"content_scripts": [
{
"matches": ["http://example.com"],
"js": ["style.js"]
}
]
}
The current setup is functional, however, it applies the styles only after the webpage has finished loading. How can I achieve an instant effect, similar to the behavior of the Stylish web extension?