XF 2.0 Using protocol-independent absolute path in [IMG] tags

Earl

Well-known member
Using protocol-independent absolute path:
<img src="//domain.com/img/picture.png"/>
If the browser is viewing a page in SSL through HTTPS, then it'll request that asset with the https protocol, otherwise, it'll request it with HTTP.
This prevents that awful "This Page Contains Both Secure and Non-Secure Items" error message in IE and some other browsers, keeping all asset requests within the same protocol, everyone knows the trick.

My question is:
Is it possible to modify the HTML source (src attribute) of the tag and get rid of these annoying none-secure items?
I don't care about broken image links. If the image is not loading, using a simple javascript like this:

JavaScript:
function testImage(URL) {
    var tester=new Image();
    tester.onload=imageFound;
    tester.onerror=imageNotFound;
    tester.src=URL;

}

function imageFound() {
    //image found code, nothing to do
}

function imageNotFound() {
    //just showing image url as a link or something
}

testImage("http://foo.com/bar.jpg");

can detect it, and put the url in code box or something.

I can't use XenForo image proxy, because it's very important to keep my server's IP address hidden (Cloudflare, and DDoS problems).
 

Similar threads

  • Suggestion Suggestion
Lack of interest Support for SVG in img tags
Replies
2
Views
743
Top Bottom