Well, it seems this hack is focused on "password" protecting the page fully client-side, meaning no headers or server auth, while .htaccess would rely on the server.
The authors hacky way have the benefit of also password-protecting the contents if you CTRL+S the page in the browser as .html, and send it to someone else.