Google recaptcha missing async and defer in script tags


(autjoe) #1

Matrix Version: [ v5.4.7.1]

We use the google recaptcha in our forms. However, we found JS API is loaded as

> <script src="https://www.google.com/recaptcha/api.js"></script>

How do we use the async and defer parameters in the script tags as suggested by google recaptcha?
Thanks.


(Tyson Adams) #2

Great question.

I don’t believe there is currently any way to do so using standard Matrix options, but I think that it would be good to see that as an available feature in a future release.

There is also Google ReCaptcha V3 in the pipeline (not sure when that will be available), which does not use those parameters in the script tag, but Matrix will still support V2 for some time.

Cheers


(Bart Banda) #3

We have added it to our backlog to add tot he script tag. In the meantime, if you are customising the form layout with keywords, you could add them using a keyword modifier like this:

%form_recaptcha^replace:>: async defer>%

(autjoe) #4

That’s great! Thanks Bart.