Magento – Captcha Called on HTTP Only

captchacheckouthttpssecuressl

I have a Magento site that has recently begun to stop showing the captcha forms. Also, some browsers (Safari) are refusing to show that my checkout page is secure because, even though the rest of the page's content is through SSL, the captcha is still being called from http and not https.

The error I get is:

[Warning] The page at [my site url] ran insecure content from http://www.google.com/recaptcha/api/js/recaptcha_ajax.js. (onepage, line 51, x2)

The offending code output appears as:

<script type="text/javascript">
    if((DRjQuery.browser.msie && parseInt(DRjQuery.browser.version, 10) != 7) || !DRjQuery.browser.msie) {
                document.write("<script type='text/javascript' src='http://www.google.com/recaptcha/api/js/recaptcha_ajax.js'><\/script>");
    }
</script>

How do I get Magento to use https for captcha?

Where can I find the code (above) where Magento outputs the http so that I can change it to https?

Best Answer

You have included the http:// protocol for the link, which is therefore making an unsecured request. Since google offer support for both the http:// and https:// protocols via the same URL, you can simply use the relative protocol // to make the browser use the current pages protocol.

<script type="text/javascript">
    if((DRjQuery.browser.msie && parseInt(DRjQuery.browser.version, 10) != 7) || !DRjQuery.browser.msie) {
            document.write("<script type='text/javascript' src='//www.google.com/recaptcha/api/js/recaptcha_ajax.js'><\/script>");
    }
</script>
Related Topic