I have a blog I would love to put a password on. I've put a simple one on it but it asks me to input a password every reload which is quite annoying.
Is there any way to make it so that it prompts only once per visit?
I've tried to do this myself but I have limited knowledge of how Javascript works and I've gotten nowhere. Also, it's not supposed to be a super serious page or anything, I'm aware you can just view source to nab the password. That's not too much of a concern, just want to deter some traffic is all.
Note: it must be Javascript and I can't do a server side password or use php. :(
What I have:
Expand|Select|Wrap|Line Numbers
- <SCRIPT language="JavaScript">
- <!--hide
- var password = prompt("Please enter the password","");
- if (password == "correct") {
- alert("You got it!");
- }
- else {
- alert("Sorry, that's not right.");
- window.location="http://google.com";
- }
- //-->
- </SCRIPT>