how can i encrypt this password protection for blogger page ? or add a function maybe ...so it wont be so obvious in the code.
and is there anyway that i could add some css design to it ? or make it to popup in the center of the screen.
<!-- paste this password form in your blogger post/page -->
<script language="JavaScript">
var password = ' '
password=prompt('This is password protected page, please enter password to continue.','');
if (password != 'password') {
location.href='https://errorpage.blogspot.com/404';
}
</script>
<!-- end password -->
ps : im new with JavaScript , still learning...
Image : https://i.sstatic.net/8mFpN.png
this is how the form looks like , but anyone could just access the code ( Ctrl + U ) and see the password ...
You can Hide whole page via css and then use js to show it. Enter below code before /head and see magic
<div style='position:fixed;overflow:none;height:100%;bottom:0;width:100%;top:0;display:table;text-align:center;background:hsla(0, 0%, 0%, 0.72)' id='passward-protected'>
<div style='display:table-cell;vertical-align:middle'>
This Page is password protected
<button onclick='enterpass()'>Enter Password</button>
</div>
</div>
<!-- paste this password form in your blogger post/page -->
<script language="JavaScript">
function enterpass(){
var password = ' '
password=prompt('This is password protected page, please enter password to continue.','');
if (password == 'password') {
document.getElementById('passward-protected').style.display='none';
}else{
alert('Wrong Password')
}
}
</script>