I need to convert all src attributes of all images on the page from relative url to absolute, so basically just to add the base url on the current src.
I know how to do that using jQuery, but I need to do it with pure JS.
Any example or idea how to do that?
In jQuery I'll do it like:
$('img').each(function() {
var urlRelative = $(this).attr("src");
var urlAbsolute = 'https://example.com' + urlRelative;
$(this).attr("src", urlAbsolute);
});