I'm trying to change image src of DOM img object, but i have a problem with an image blinking when try to change it using chrome extention.
manifest.json
"content_scripts": [{
"js": ["./js/content.js"],
"matches": ["*://example.com/*"],
"run_at": "document_start"
}
content.js
var img = 'data:image/png;base64,.....'
var avatar = (document.getElementsByClassName('page_avatar_img'))[0];
avatar.src = img;
In this case, the extension waits for the DOM object to be created and only then replaces the original image to my img with blinking.
Can I change the text of an html document before creating a DOM object to avoid this and immediately create the object I need?
Change "run_at" on "document_start" in manifest.json did not help me, because chrome extention can't find an 'avatar' object.
Thank everyone for answers!