A static, frontend-only newsletter signup page used as a teaching example. Nothing is actually subscribed to anything. The form submit is intercepted by JavaScript, a short fake-network delay runs, and the user is routed to success.html or failure.html based on a couple of basic regex checks in js/signup.js.
No server, no API keys, no database. Pure HTML/CSS/JS — safe to host on GitHub Pages.
The browser does a first pass with HTML5 (required + type="email"), then js/signup.js does a stricter pass: names must start with a letter and be ≥2 characters of letters / spaces / hyphens / apostrophes only, and emails must have a TLD of at least 2 characters.
To reach success.html — fill in plausible values that satisfy both passes, e.g. Angela, Yu, angela@appbrewery.com.
To reach failure.html — submit something that passes HTML5 but fails the stricter JS rules. Examples:
- A 1-character name:
J,Yuis fine butJalone isn't. - A name with a digit or symbol:
Anna1,M@ry. - An accented or non-ASCII name:
José,Müller(the basic ASCII regex rejects them — a known limitation). - An email with a 1-character TLD:
test@gmail.c. - An email with no TLD at all (Chrome accepts these as valid HTML5):
test@gmail.
A quick recipe to demo the failure page: Jo, D, jo@x.c → submit → wait ~700 ms → you land on failure.html.
Just open index.html in a browser, or serve the directory with any static server:
python3 -m http.server 8000Then visit http://localhost:8000.