Support » Plugin: LiteSpeed Cache » Contact Form 7 ReCAPTCHA issue

  • Resolved Ian Pegg

    (@ianpegg)


    Hi,

    I’ve just updated to v5.1.1 of CF7 and implemented the new Google ReCAPTCHA v3. It works fine logged in (as all caching is turned off for my admin account), but when logged out the external asset that gets loaded in from https://www.google.com/recaptcha/api.js is requested after the inline script that it supports. This leads to an Uncaught ReferenceError as the inline script gets executed first and so ends up trying to refer to an object that doesn’t exist yet.

    The external resource is added by CF7, so I don’t have the luxury of editing the load order of the script myself without editing the plugin. Because the uncached version of the page works fine, it seems that your plugin is changing the load order of JS resources as part of its optimisation process. Using your plugin, is there a way to give a higher load priority to a particular script so that I could force the external resource to be fetched before the inline script executes?

    Thanks for your help!

Viewing 15 replies - 16 through 30 (of 33 total)
  • Plugin Author Hai@LiteSpeed⚡

    (@hailite)

    Based on later version CF7 v5.1.3, in recaptcha.php

    line 72
    Change

    <script type="text/javascript">
    ( function( grecaptcha, sitekey, actions ) {

    to

    <script type="text/javascript">
    document.addEventListener( 'DOMContentLoaded', function( event ) {
    ( function( grecaptcha, sitekey, actions ) {

    Line 125
    Change

    );
    </script>

    to

    );
    } ) ;
    </script>

    I pasted the context and the modification is new lines too. This could be more clear to understand/edit.

    uzipit

    (@uzipit)

    @hailite thanks for the lightning speed response..:)

    I’m a bit confused, in your response above you say “Based on later version CF7 v5.1.3” but we have the latest ver installed and its: Version: 2.9.8.2

    Am I missing anything?

    Thanks

    Plugin Author Hai@LiteSpeed⚡

    (@hailite)

    https://wordpress.org/plugins/contact-form-7/

    Please check the version here.

    uzipit

    (@uzipit)

    @hailite sorry, I thought you meant Lightspeed ver.
    I made the changes and now the recaptcha issue is fixed, thanks for that.

    BUT, the issue with Lazy load is not fixed – our banner images are not loading at all when Lazyload is enabled.
    (you can have a look at our site here: http://www.ukitservice.co.uk)

    Any idea how to fix this?

    Thanks

    Plugin Author Hai@LiteSpeed⚡

    (@hailite)

    banner images usually need to exclude from lazyload.

    Can consider to exclude their classname tp-bgimg defaultimg

    uzipit

    (@uzipit)

    I’ve added ‘tp-bgimg defaultimg’ under Lazy Load Image Excludes but still images not loading.

    It used to work with other banner images, but it’s not working now.
    What else can we do pls?

    Plugin Author Hai@LiteSpeed⚡

    (@hailite)

    This is your current source code:

    https://imgur.com/a/q7UfpfJ

    uzipit

    (@uzipit)

    Sorry, I’m not a dev guy.. no idea what this means?

    uzipit

    (@uzipit)

    @hailite so what do I need to do to fix this pls?

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    @uzipit , please check this wiki

    Best regards,

    OSD

    (@osd)

    @hailite,

    However I changed line 72 and 125 in the CF7 v5.1.3 recaptcha.php the contact form still doesn’t work…

    Plugin Author Hai@LiteSpeed⚡

    (@hailite)

    @osd Can you give a report number? Need to visit your site to see if the change is as expected.

    @hailite OJBMJYHO

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    Please try set “Exclude JQuery” to ON

    Best regards,

    Plugin Author Hai@LiteSpeed⚡

    (@hailite)

    There is something that @qtwrk need to mention. The reason you can try that option is bcos after checked your site, we found in developer tools, the JS errors shown is not related to CF7 but jQuery. I believe we have a wiki on that.

Viewing 15 replies - 16 through 30 (of 33 total)
  • The topic ‘Contact Form 7 ReCAPTCHA issue’ is closed to new replies.