I’ve been looking at password protection for HTML and most of the protection listed appears to be overkill for my needs.
I just want to have some portfolio images (nothing that needs to be private and it doesn’t matter if any advanced programmer or someone that knows how to open the code can get into it because nothing is sensitive), I just don’t want the average user to access certain areas of site and only allow someone who I give the password (for example on my business card.)
Does anyone have any suggestions or direction I should look?
Use javascript in your main page, something like this:
<body>
Enter password: <input id='password' type='text' />
<a href="your_image_portfolio.html" onclick="javascript:return validatePass()">enter your password and click this</a>
<script>
function validatePass(){
if(document.getElementById('password').value == 'yourBussinessCardPassword'){
return true;
}else{
alert('wrong password!!');
return false;
}
}
</script>
</body>
It's very insecure, but it will do what you want for non technical users...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With