Answer the question
In order to leave comments, you need to log in
How to bulk replace links to images?
Hey!
I would be grateful if you could help me with a solution. The site has pictures with links like site.ru/_pu/15/18034358.jpg to reduce the load on the site, I uploaded all the pictures to the repository. Now I need to send pictures to users at the new address. How to replace all links to images starting with site.ru/_pu/ with site2.ru/_pu/ using js/jquery, and will this reduce the load? There is no access to php, images have no classes and id either.
Thanks for answers!
Answer the question
In order to leave comments, you need to log in
for (const img of document.querySelectorAll('img')) {
img.src = img.src.replace('site.ru', 'site2.ru')
}
and will it reduce the load
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question