Docs

The JavaScript presence checkUpdated

5 min readUpdated November 19, 2026

The JavaScript presence check is a cheap, invisible test that runs before any CAPTCHA. Each protected form carries a hidden field that stays empty until JavaScript in the visitor’s browser fills it in. A submission that arrives with the field still empty did not come from a browser running the form.

Most simple bots post directly to the login URL without loading the page or running its scripts, so they never fill the field.

What it does#

  1. The login form includes a hidden field named nahnls_js, empty by default.
  2. A small script from the plugin runs when the page loads and sets the field to 1.
  3. When the form is submitted, Shield checks for that 1.

The same script also refreshes a hidden security token on the form. That means a login page served from a cache still passes the token check. See “Caching and login pages” under Troubleshooting.

Why it runs first#

The check runs before any CAPTCHA or OOPSpam call. A bot that fails it never reaches a provider, so you don’t spend CAPTCHA or API quota on it. The Settings description says the same: “Most bots skip JS. Runs before any CAPTCHA or API call, saving quota.”

Turn it on or off#

  1. Go to Settings → Login Shield and open the General tab.
  2. Find Require JavaScript.
  3. Toggle Block submissions with no JavaScript marker.
  4. Save.

It is on by default. Leave it on unless you have a specific reason to turn it off.

The Require JavaScript setting on the General tab with two switches turned on: Block submissions with no JavaScript marker, and Strict: refuse the login before the password is checked.

Standard and Strict mode#

There are two levels. Strict was added in version 1.0.19 and is off by default.

Standard (default)Strict
WooCommerce login, registration, checkout and order tracking, the integration forms (Bricks, SureForms, comments) and custom formsRefused without the markerRefused without the marker
WordPress login (wp-login.php) without the markerNot refused by this check alone. The attempt goes on to the normal password checkRefused before the password is checked
WordPress registration and lost password formsThe marker is not checked. Only the CAPTCHA isThe marker is not checked. Only the CAPTCHA is
With the early-block mu-pluginNo changeRefused before plugins and the theme load

Strict is made for sites under heavy bot traffic. A bot that posts straight to the login address is answered without WordPress looking up the user or checking a password, which is the slowest part of a login.

Turn on Strict

  1. On the General tab, find Require JavaScript and make sure it is on.
  2. Turn on Strict: refuse the login before the password is checked.
  3. Save.
  4. Open a private browser window and sign in, to confirm your login form still works.

Before you turn it on

  • Every login form must carry the marker. The WordPress login page, WooCommerce and Bricks login forms do. A custom form from a theme or another plugin that posts to wp-login.php without the marker stops working in Strict mode.
  • Open login pages expire. In Strict mode the security token on the form is checked too. A login page left open for about a day shows “Security check expired” and needs a reload.
  • Refused logins and lockouts. When the early-block mu-plugin refuses a login this way, the event log records one row per IP per minute, and the attempt does not count towards a lockout. An IP that keeps trying is still caught by the mu-plugin’s rate limit. Without the mu-plugin, each refused login counts as a failed attempt as usual.

What visitors see#

Visitors with JavaScript don’t notice anything. A visitor with JavaScript disabled sees this notice on the form: “JavaScript is required. Please enable JavaScript in your browser to sign in.” If they submit anyway and the form is refused, they get the message “JavaScript verification failed. Please enable JavaScript and try again.” Custom forms that use nahnls_check_submission() show “JavaScript is required. Please enable JavaScript and try again.”

In Strict mode with the early-block mu-plugin, a login without the marker gets a plain page that says “JavaScript required”.

Where it applies#

The check covers the login form, and also the other forms Shield protects when they’re enabled: the WooCommerce login, registration, checkout and order tracking forms, and the integration forms. The WordPress registration and lost password forms carry the hidden field, but the marker is not checked there. Only the CAPTCHA is. The check also applies to custom forms you protect with nahnls_check_submission(). If you build a custom form with Shield’s helper, the hidden field is included for you. If you write your own markup, see the Developer API docs.

What it doesn’t do#

The check stops basic bots. It does not stop a bot that runs a real browser or sets the field itself. Treat it as the first layer, not the only one. Pair it with lockout, a CAPTCHA, and 2FA.

Troubleshooting#

  • Real users see “JavaScript is required”:
    • A browser extension or privacy tool is blocking scripts on your site.
    • A caching or optimization plugin is delaying or removing Shield’s script. Exclude the Shield script from minification, combining and delay-until-interaction settings.
    • Another script error on the page stops scripts from running. Open the browser console to check.
  • Logins from a cached page fail: the security token on the page is stale. Shield refreshes it with JavaScript, so confirm the script is loading. See the caching docs.
  • A login form stopped working after you turned on Strict: that form doesn’t carry the marker. Turn Strict off, or switch to a login form Shield protects.
  • API or automated logins are blocked: in Strict mode, or on a WooCommerce login form, a tool that posts directly to the login form is refused because it doesn’t run JavaScript. In standard mode a wp-login.php login with a correct password is not refused by this check. Either bypass Shield for that tool, or turn Strict or the check off, knowing it protects only against basic bots.
  • A custom form always fails: it’s missing the hidden field. Use Shield’s form helper, or add the field yourself per the Developer API docs.

Was this helpful?

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only