Ask For Their Name
windows and alerts 1996 still worksPrompts for a name on arrival and greets them by it.
In 2026: Works. Storing the answer in a cookie so they are only asked once is the part most 1996 copies of this script forgot.
Where it came from: Netscape JavaScript 1.0 prompt, 1996. MDN ↗
<script language="JavaScript">
var who = null, m = null;
try { m = document.cookie.match(/visitorname=([^;]+)/); } catch (e) { m = null; }
if (m) {
who = decodeURIComponent(m[1]);
} else {
who = prompt("Hi! What's your name?", "");
try {
if (who) document.cookie = "visitorname=" + encodeURIComponent(who)
+ "; path=/; max-age=31536000";
} catch (e) {}
}
if (who) document.write("<h2>Welcome, " + who + "!</h2>");
</script>