josiasmontag / laravel-recaptchav3

Laravel package for Google's Recaptcha V3
MIT License
188 stars 37 forks source link

Uncaught ReferenceError: grecaptcha is not defined #22

Open theweirdgenius opened 2 years ago

theweirdgenius commented 2 years ago

Getting this error

apiaget commented 2 years ago

Hi, I also got this error. The solution was to load the JavaScript in the head and not at the bottom of the body.

<html>
    <head>
        <title>Test</title>
        [...]
        {!! RecaptchaV3::initJs() !!}
    </head>
    <body>
        [...]
    </body>
</html>
sam-stickyeyes commented 4 months ago

I've added a PR here to allow initJs to be called at the end of the doc, as the JS is pretty hefty and blocks rendering, which isn't good for Google performance scores.

https://github.com/josiasmontag/laravel-recaptchav3/pull/41