[{"data":1,"prerenderedAt":155},["ShallowReactive",2],{"use-case-\u002Fuse-cases\u002Fpassword-protect-html-page":3},{"id":4,"title":5,"body":6,"comparison":90,"cta":120,"description":123,"extension":124,"faqs":125,"h1":135,"meta":136,"navigation":137,"path":138,"pillar":139,"platform":142,"seo":143,"siblings":144,"stem":151,"updated":152,"valueProp":153,"__hash__":154},"useCases\u002Fuse-cases\u002Fpassword-protect-html-page.md","Password Protect an HTML Page (Properly) | Hostsmith",{"type":7,"value":8,"toc":83},"minimark",[9,18,23,26,34,38,60,64,80],[10,11,12,13,17],"p",{},"This one comes up constantly: someone has a single ",[14,15,16],"code",{},"index.html"," - a proposal, a lookbook, a one-page site - and wants a password in front of it. They search, find a snippet of JavaScript that prompts for a password, and ship it. Please don't. Here is why, and what to do instead.",[19,20,22],"h2",{"id":21},"why-a-raw-html-page-cant-gate-itself","Why a raw HTML page can't gate itself",[10,24,25],{},"An HTML file is markup the browser downloads and renders. There is no point in that process where it can ask \"who are you?\" and refuse to load. So every client-side \"password\" gate works the same way: the password and the secret URL live in the page you already sent. Open the dev tools, read the source, done. It is a speed bump, not a lock.",[10,27,28,29,33],{},"Real protection happens ",[30,31,32],"strong",{},"before"," the bytes leave the server. The server checks the password (or your identity) and only then sends the page. The browser never sees protected content unless you are allowed in.",[19,35,37],{"id":36},"the-real-options","The real options",[39,40,41,54],"ul",{},[42,43,44,53],"li",{},[30,45,46,49,50],{},[14,47,48],{},".htaccess"," + ",[14,51,52],{},".htpasswd"," on an Apache server is genuine server-side protection. It is also the most setup: you need Apache, server access, and to be comfortable editing hidden files and hashing a password. If that sentence sounded fine, it is a perfectly good answer.",[42,55,56,59],{},[30,57,58],{},"A host with built-in protection"," does the same server-side check as a toggle. No server admin, no config files.",[19,61,63],{"id":62},"how-hostsmith-handles-it","How Hostsmith handles it",[65,66,67,74,77],"ol",{},[42,68,69,70,73],{},"Drop your ",[14,71,72],{},".html"," file - or a ZIP with its images and assets - onto Hostsmith for a free public link.",[42,75,76],{},"On the Pro plan, turn on Private Sites.",[42,78,79],{},"Choose a shared password, or an email whitelist so only specific addresses get in.",[10,81,82],{},"The gate runs on the server, so the page is never sent to someone who hasn't passed it. Password protection, custom domains and EU partitions are Pro features; the free tier gives you a public link, not a gate.",{"title":84,"searchDepth":85,"depth":85,"links":86},"",2,[87,88,89],{"id":21,"depth":85,"text":22},{"id":36,"depth":85,"text":37},{"id":62,"depth":85,"text":63},{"caption":91,"columns":92,"rows":96},"Ways to password-protect an HTML page (capabilities, not prices)",[93,94,95],"Approach","What it really gives you","Hostsmith",[97,101,105,109,113,116],{"feature":98,"them":99,"us":100},"JavaScript password prompt","No real protection - password and URL are in the page source","Server-side gate; nothing sent until the password checks out",{"feature":102,"them":103,"us":104},".htaccess + .htpasswd","Strong, but needs Apache, server access and config","One toggle, no server admin",{"feature":106,"them":107,"us":108},"Shared-password link","Depends on your host","Built in on Pro",{"feature":110,"them":111,"us":112},"Email-whitelist access","Rarely available without extra tooling","Yes, list the allowed emails (Pro)",{"feature":114,"them":107,"us":115},"EU data partition","EU partition on Pro",{"feature":117,"them":118,"us":119},"Free public link","Yes, on most static hosts","Yes - free tier, public link",{"heading":121,"sub":122},"Gate one HTML page in two minutes","Drop the file for a free link, then add a real password on Pro.","A raw HTML page can't password-protect itself, and JavaScript gates aren't security. Host the page behind a server that checks the password - drop it on Hostsmith and gate it on Pro.","md",[126,129,132],{"q":127,"a":128},"Can an HTML page password-protect itself?","No. An HTML file is just markup the browser renders; it has no way to check a credential before it loads. Any 'password' you add in client-side JavaScript ships inside the page - the password, the comparison and the protected URL are all readable in the browser's dev tools. That is obscurity, not protection.",{"q":130,"a":131},"Isn't a JavaScript password gate good enough for low stakes?","It stops a casual passer-by and nobody else. Search engines can crawl the redirect target, cached copies leak, and anyone curious opens dev tools. If it genuinely doesn't matter who sees the page, you don't need a gate; if it does, you need a real one.",{"q":133,"a":134},"What's the simplest real way to gate one HTML page?","Host it somewhere that checks the password on the server. Drop the .html file (or a ZIP with its assets) onto Hostsmith for a free public link, then on Pro turn on Private Sites with a shared password or an email whitelist. The gate runs before any content is sent.","Password protect an HTML page, properly",{},true,"\u002Fuse-cases\u002Fpassword-protect-html-page",{"label":140,"to":141},"Full guide: how to password protect a website","\u002Fblog\u002Fpassword-protect-website","a static HTML page",{"title":5,"description":123},[145,148],{"label":146,"to":147},"GitHub Pages password protect","\u002Fuse-cases\u002Fgithub-pages-password-protect",{"label":149,"to":150},"Vercel password protection","\u002Fuse-cases\u002Fvercel-password-protection","use-cases\u002Fpassword-protect-html-page","2026-06-16","A raw HTML file can't gate itself, and a JavaScript password check is security theatre. Host the page behind something that checks the password before sending bytes - drop it on Hostsmith and turn on a real gate on Pro.","XL9E1gapP8nOfOex6ItaAEVgk3IDPaHuOlZZY5hMz5Y",1781808843899]