There is an issue with all Stack Exchange sites: Even when Stack Overflow is browsed using HTTPS all custom avatars are fetched via HTTP (although they are also available via HTTPS).
The question was closed as duplicate and there will be probably no action in the nearest future, so I wanted to workaround it with Greasemonkey.

I was able to replace all URLs to images with following scripts:

var links = document.evaluate("//img[contains(@src, 'http://i.stack.imgur.com')]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); 
for (var i=0; i < links.snapshotLength; i++) 
{ 
    var thisLink = links.snapshotItem(i); 
    hisLink.src = thisLink.src.replace("http://i.stack.imgur.com/", "https://i.stack.imgur.com/");
} 

Source URLs are replaced, but as I see in a Firebug console Firefox first fetches it via HTTP and for a moment fetches them again via HTTPS (and rightly display a warning Loading mixed (insecure) display content on a secure page "http://i.stack.imgur.com/tKsDb.png").

My question. Is it possible to use Greasemonkey to change a page (URLs to the images) before Firefox will fetch them?

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top