Skip to content

Instantly share code, notes, and snippets.

@scripting
Last active May 19, 2025 20:33
Show Gist options
  • Save scripting/ffea3997c193552deb8fc8c864e8ebee to your computer and use it in GitHub Desktop.
Save scripting/ffea3997c193552deb8fc8c864e8ebee to your computer and use it in GitHub Desktop.
I was going to use this in my search engine, when it wanted to display an image over http, reroute it to use an https proxy server. But Chrome wouldn't stay out of the way, so had to give up. Hey I was trying to route around their outage.
function reRouteImgs () { //5/19/25 by DW
$(window).on ("load", function () {
console.log ("reRouteImgs");
$("body img").each (function () {
const url = $(this).attr ("src");
if (beginsWith (url, "http://")) {
console.log ("reRouteImgs: url == " + url);
const proxiedUrl = "https://someproxy.com/?url=" + encodeURIComponent (url) + "&nocache=" + Date.now ();
$(this).attr ("src", "");
$(this).attr ("src", proxiedUrl);
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment