In some cases, the password protection may conflict
based web menu.
In version 4.8, HTML Password Lock added a new "Generate
a standalone login file for each locked HTML file"
option in Step 3, Advanced Options
dialog. With this option, these web pages can be password protected
with HTML Password Lock perfectly. For more details, please
How to password protect
based web menu?
locked HTML file, but if you don't want to do that, there are
still three ways to solve this problem.
To solve the problem, simply move the scripts from the
external .js file to the HTML file itself to solve the problem.
For example, a reference to an external .js file in your
HTML file may look like this:
Please check your HTML file. If it contains such references,
the HTML file itself, then this problem will be fixed.
That is, change the line above to:
(move all scripts here from
If the above method does not fix the problem, you can try
fixing it as following:
1. Suppose the HTML that needs for protection is http://www.yoursite.com/member.html.
You can create a web page that will automatically redirect
to the member page, and lock this web page. The code for
this web page might read as shown below, provided you change
the filename "http://www.yoursite.com/member.html"
to your own filename. Please DO NOT lock the member.html
If the page does not redirect automatically, please <a href="http://www.yoursite.com/member.html">click
Suppose the new page you created with the above code is
login.html. In that case, you
need to lock this new file with HTML Password Lock and upload
the locked page to your web server as http://www.yoursite.com/login.html
. When your visitor views this page, he will
see the login box, after a correct login, he will be automatically
redirected to the page http://www.yoursite.com/member.html,
the real member page.
2. The flaw in this solution is that a visitor might try
to access directly the member page by typing in the URL
address or bookmarking the member page, thus bypassing the
password protection. To stop this and force visitors to
the login page when they directly type in or bookmark the
member page URL, please add the codes shown below to the
member page, changing the http://www.yoursite.com/login.html
to your own login filename created in the previous step.
if (document.cookie.length<0) return false;
if (begin==-1) return false;
if (end==-1) end=document.cookie.length;
if (result=="valid") return true; else return false;
var bRet = checkvalid();
if (!bRet) this.location.href="http://www.yoursite.com/login.html";
If the above won't do it, you can use a third method. Remove
the locked page to your other web pages with IFRAME.
The following explains how to use IFRAME to embed a locked