New here, Javascript password protect site not working on mobile


Joined
Oct 12, 2021
Messages
3
Reaction score
0
Hi there! I recently created a weebly site (herphusbandry.weebly.com). I am thinking about starting a Patreon, and for one of the perks I was going to create a password-protected site with exclusive content, and only give the password to my Patrons. I found this JavaScript code online for password protecting the site, and it works fine on desktop devices when I put it in the header code, but not on mobile. Any ideas?

<SCRIPT language="JavaScript">
<!--hide

var password;

var pass1="HerpHusbandry";

password=prompt ('Please enter your password to view this page! - Hint its HerpHusbandry',' ');

if (password==pass1)
alert ('Password Correct! Click OK to enter!');
else
{
window.location="https://wronghhpassword.weebly.com/";
}

//-->
</SCRIPT>

(P.S., I will change the password before continuing!)
 
Ad

Advertisements

Joined
Nov 13, 2020
Messages
80
Reaction score
14
JS does a piss poor job of protecting a site. You need a database and a server side language like PHP.
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top