JavaScript Widget

The widget attaches to any <input type="email"> on your page and verifies emails on blur. Sub-200ms responses, sets HTML5 setCustomValidity on invalid addresses, and suggests fixes for common typos like gmial.com.

Install

<script src="https://verifier.example.com/widget.js" defer></script>
<script>
  window.addEventListener("DOMContentLoaded", function () {
    window.Verifier.init({
      apiUrl: "https://api.verifier.example.com",
      widgetKey: "vk_your_widget_key"
    });
  });
</script>

Options

  • widgetKey — required. Create in the Widget page.
  • apiUrl — backend URL. Defaults to production.
  • attachTo — CSS selector. Defaults to input[type="email"].
  • onResult — callback receiving (result, email).

Origin allowlist

Each widget key is locked to specific origins (e.g. https://example.com). Requests from other origins are rejected with HTTP 403.

Subresource Integrity (recommended)

For maximum hardening, pin to a versioned bundle URL and add an integrity attribute. We publish the SHA-384 hash on every release.

<script
  src="https://verifier.example.com/widget.v1.js"
  integrity="sha384-PUBLISHED_HASH_HERE"
  crossorigin="anonymous"
  defer
></script>