HTML Password Protector will protect whole HTML page or only part of it using password. A lot of HTML protectors available. They can be divided into two main categories:
- obfuscators, which simply use JavaScript escape/encodeURI functions to obfuscate HTML. Such HTML can be easily decoded using unescape/decodeURI functions
- login box adder, which adds JavaScript login prompt and do not encode HTML. HTML can be easily seen by disabling JavaScript in browser settings
- combination of above.
This tool is much more secure. It will encode HTML using your password, and will add a password box. Incorrect password will result in incorrectly decoded HTML.
Requirements: JavaScript 1.2 (tested on Firefox 2.0, Firefox 3.5, IE 6.0, IE 8, Opera 7.51, Opera 9, Google Chrome. May also work on other browsers/versions). IE8 has a restriction, users will see yellow strip at the top of the page. Will have to click yellow strip and select Allow Blocked Content.
Note: it cannot encode short text due to the nature of encoding. Longer passwords result in better encoding.
<script type="text/javascript" size="35"> <!--linebreak function get_password() { orig_pass = prompt("Please enter password:[NB ONE attempt only!]",""); if (orig_pass!=null && orig_pass!="") password = new Array(orig_pass.length); for(i=0; i<orig_pass.length; i++) { password[i] = orig_pass.charCodeAt(i); } return password; } password = get_password(); orig = unescape("thecode"); orig = orig.split(""); passnum = orig.length % password.length; for(i=orig.length-1; i>=0; i--) { passnum--; if (passnum == -1) passnum = password.length - 1; pos1 = i; pos2 = i + password[passnum]; if (pos2 >= orig.length) continue; char1 = orig[pos1]; char2 = orig[pos2]; orig[pos2] = char1; orig[pos1] = char2; } orig1 = ""; for(i=0;i<orig.length;i++) { orig1 = orig1 + orig[i]; } orig1 = orig1.replace(/mmm/g,"\r\n"); document.write(orig1); //-->linebreak </script> <noscript>JavaScript must be enabled in your browser in order to see protected page.</noscript>