Skip to content
← Templates

Plain HTML Gate

A copy-paste HTML password screen for static sites and legacy pages — no React, no build step, no npm install. One file, zero dependencies.

Client previewSimpletemplatehtmlno-buildv1.0.0

Best used for A static site, a legacy page, or anywhere a React build step isn't an option.

A single <script> tag reimplements the same canonical hashing contract as every other template (UTF-8 encode, lowercase hex SHA-256) using nothing but the browser's built-in Web Crypto API — no bundler, no package.json, no framework. Unlock state persists across reloads via localStorage with the same 30-minute default timeout as the React templates.

// Usage

Minimal setup

<script>
  var EXPECTED_HASH = "…"; // paste your generated hash here
</script>
<main id="protected-content" hidden>
  <!-- your real page markup -->
</main>
Installation

Add this file to your project

No CLI, no npm install, no build step — copy the file below (or use the Code tab in the preview above) into your project as a plain .html file and open it directly.

plain-html-gate.html

Installing via an AI agent?

Drop AGENTS.md into your project root — it instructs any coding agent to hash the code locally, write only the hash, and confirm the plaintext never touched a file. Thin pointer files exist for tools that read a different filename.

Notes

Accessibility

The code field has its own label and an accessible show/hide toggle. Errors and the checking state announce through a role="status" aria-live="polite" region, the same contract every other template uses.

Customization

Everything — styles, verification logic, and the gated content itself — lives in this one file, with no imports at all. Edit EXPECTED_HASH and the #protected-content block directly; there's no prop API since there's no component.

Security & Verification

Need a hash? Use the hash generator on Getting Started — computed locally, never sent anywhere.

The honest version

Knock Codes stops casual visitors, search engines, and forwarded links. Local mode does not stop anyone who opens DevTools — the hash ships in your client bundle by design. Server mode (swap one prop) hides the hash from the client; children you already bundled are still in the JavaScript, and a forged session works unless you wire validateSession. A velvet rope, with an optional real lock. Never marketed as more than that.