Created
July 21, 2023 01:31
-
-
Save murrayinman/d897f6aa281e67d967ca5aa2f25cfb87 to your computer and use it in GitHub Desktop.
This will search the page for `https\://` and strip the `\` character from image src attributes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var imgElements = document.getElementsByTagName('img'); | |
for (var i = 0; i < imgElements.length; i++) { | |
var src = imgElements[i].getAttribute('src'); | |
var modifiedSrc = src.replace(/https\\:/g, 'https:'); | |
imgElements[i].setAttribute('src', modifiedSrc); | |
} | |
console.log('Image URLs fixed!'); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment