I am writing a chrome extension to replace all the occurrences of certain set of image ( I have the image names) and replace it with another image (src)
I need to find all the occurrences of a certain image name in a website and replace the src of the image with a custom image.
I can find the image name in
<img> tags with the following snippet
var key = 'img[src*="' + src + '"]'; var img = $(key); img.attr('src', 'http://blah.blah/a.png);
Problem occurs when the image is set as
background-image or as a css property.
Is it possible to scan the
jQuery (recursively in all the attached style sheets) and replace all the occurrences of the image with the target url? If it is possible, can anyone point me in the right direction?