block-explorer
block-explorer copied to clipboard
Fix insecure images
On the homepage, there are links served from insecure domains. This makes the padlock in Firefox's URL bar gray with a caution sign.
Here's a function I made for .tech:
function makeImageSourceSecure(url) {
const originalUrl = new URL(url);
if (originalUrl.protocol !== "https")
return `https://${originalUrl.host}${originalUrl.pathname}`;
return originalUrl.href;
}