Joomla Recaptcha V2

Google is committed to advancing racial equity for Black communities. See how.
Download

The reCAPTCHA plugin, which protects your contact and registration forms against spam, has been updated in Joomla! While still supporting the old reCAPTCHA 1.0, you can use the reCAPTCHA version 2.0. A significant number of your users can now attest they are human without having to solve a CAPTCHA. Recaptcha plugin with capthca v2 for Joomla 2.5 is © 2018 by Marco Balestra, altersoftware.it Free for personal and commercial use, no implicit or explicit warranty is provided, released under CCA 4 license. © 2009 altersoftware.IT - Cited marks © by respective owners.

This page explains how to display and customize the reCAPTCHA v2 widget on your webpage.

To display the widget, you can either:

Recaptcha v2 admin
  • Automatically render the widget or

See Configurations to learn how to customize your widget. For example, you may want to specify the language or theme for the widget.

Buy lightroom classic. See Verifying the user's response to check if the user successfully solved the CAPTCHA.

Joomla

Automatically render the reCAPTCHA widget

Crack

The easiest method for rendering the reCAPTCHA widget on your page is to includethe necessary JavaScript resource and a g-recaptcha tag. The g-recaptcha tagis a DIV element with class name g-recaptcha and your site key in thedata-sitekey attribute:

The script must be loaded using the HTTPS protocol and can be included from anypoint on the page without restriction.

Explicitly render the reCAPTCHA widget

Deferring the render can be achieved by specifying your onload callback functionand adding parameters to the JavaScript resource.

  1. Specify your onload callback function. This function will get called whenall the dependencies have loaded.

  2. Insert the JavaScript resource, setting the onload parameter to the nameof your onload callback function and the render parameter to explicit.

    When your callback is executed, you can call the grecaptcha.render methodfrom the JavaScript API.

    Your onload callback function must bedefined before the reCAPTCHA API loads. To ensure there are no raceconditions:
    • Order your scripts with the callback first, and then reCAPTCHA
    • Use the async and defer parameters in the `script` tags

Configuration

JavaScript resource (api.js) parameters

ParameterValueDescription
onloadOptional. The name of your callback function to be executed once all the dependencies have loaded.
renderexplicit
onload
Optional. Whether to render the widget explicitly. Defaults to onload, which will render the widget in the first g-recaptcha tag it finds.
hlSee language codesOptional. Forces the widget to render in a specific language. Auto-detects the user's language if unspecified.

g-recaptcha tag attributes and grecaptcha.render parameters

g-recaptcha tag attributegrecaptcha.render parameterValueDefaultDescription
data-sitekeysitekeyYour sitekey.
data-themethemedark lightlightOptional. The color theme of the widget.
data-sizesizecompact normalnormalOptional. The size of the widget.
data-tabindextabindex0Optional. The tabindex of the widget and challenge. If other elements in your page use tabindex, it should be set to make user navigation easier.
data-callbackcallbackOptional. The name of your callback function, executed when the user submits a successful response. The g-recaptcha-response token is passed to your callback.
data-expired-callbackexpired-callbackOptional. The name of your callback function, executed when the reCAPTCHA response expires and the user needs to re-verify.
data-error-callbackerror-callbackOptional. The name of your callback function, executed when reCAPTCHA encounters an error (usually network connectivity) and cannot continue until connectivity is restored. If you specify a function here, you are responsible for informing the user that they should retry.

JavaScript API

MethodDescription
grecaptcha.render(
parameters
)
Renders the container as a reCAPTCHA widget and returns the ID of the newly created widget.
container
The HTML element to render the reCAPTCHA widget. Specify either the ID of the container (string) or the DOM element itself.
parameters
An object containing parameters as key=value pairs, for example, {'sitekey': 'your_site_key', 'theme': 'light'}. See grecaptcha.render parameters.
grecaptcha.reset(
)
Resets the reCAPTCHA widget.
opt_widget_id
Optional widget ID, defaults to the first widget created if unspecified.
grecaptcha.getResponse(
opt_widget_id
)
Gets the response for the reCAPTCHA widget.
opt_widget_id
Optional widget ID, defaults to the first widget created if unspecified.

Examples

Joomla 3 Recaptcha V2 Plugin

Explicit rendering after an onload callback

Joomla Recaptcha V2

Explicit rendering for multiple widgets