evoWeb / recaptcha

TYPO3 Extension to make use of googles nocaptcha
GNU General Public License v2.0
6 stars 18 forks source link

Only includeJS when form is included in the page #77

Closed mikestreety closed 1 year ago

mikestreety commented 1 year ago

Would it be possible to only load the recaptcha JS only when a form with the recaptcha is added to the page?

or does the JS need to be on every page to get a "sense" of if the user is a bot or a person?

I only ask as Lighthouse penalises for unused JS

garbast commented 1 year ago

You can use page.includeJSFooterlibs.recaptcha > in TypoScript and add the line yourself how ever you like to use it. For example add the script tag only in the recaptcha partial https://github.com/evoWeb/recaptcha/blob/12.0.1/Resources/Private/Frontend/Partials/Recaptcha.html