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>");

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?


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>");
| improve this answer | |
  • right. But where can I access this code? I have looked everywhere. Would you happen to know which file it would be in? – YWSW Jan 5 '15 at 15:07
  • To my knowledge recaptcha has never been a part of core Magento, so where it exists will depend on the implementation you're using. In the Fontis module for example, it appears to be in app/code/community/Fontis/Recaptcha/Helper/Data.php. – Peter O'Callaghan Jan 5 '15 at 15:38
  • To my knowledge we are not using any extension for the Captcha. I see that we have the file app/code/core/Mage/Captcha/Helper/Data.php but the incorrect http URL is not there. Where can it be? – YWSW Jan 5 '15 at 16:21
  • Mage_Captcha is not related to recaptcha. As stated, I don't believe it's in core, so I can't help with where. Whichever module adds jQuery as DRjQuery is presumably the source. – Peter O'Callaghan Jan 5 '15 at 16:28
  • success!!! You were right! It was an extension from MageWorkshop called Detailed Review (the 'DR' you hinted to). They must have hardcoded the 'http' in by mistake... Thank you so much!! – YWSW Jan 5 '15 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.