I am trying to make a chrome extension that changes the css of a website. The css is loaded from pastebin with Ajax. The problem is that the old website is shown before the new css is shown- how can I make it so that only the website with changed css is shown?
Content.js:
var s = document.createElement('style');
s.setAttribute("type", "text/css");
var r;
$('head').ready(function() {
$.get("https://pastebin.com/raw/css-file", function(r) {
s.innerHTML = r;
document.head.appendChild(s);
});
});
manifest.json (relevant):
{
"permissions": [
"https://scratch.mit.edu/*",
"https://pastebin.com/raw/*"
],
"content_scripts": [
{
"matches": [
"https://scratch.mit.edu/*",
"http://scratch.mit.edu/*"
],
"js": ["jquery-2.2.2.min.js", "content.js"]
}
]
}