Placing a Link from an Unprotected Page to a Protected Page
Step1
Open the unprotected page in a basic text editor. Place the cursor where the link will appear.
Step2
Type the following, substituting your own text or graphic:
Click here to access the password protected page.
Step3
Upload your file to the correct place in the file directory.
Creating a Script for the Password Page
Step1
Open a basic text editing program. Begin by typing the opening tags:
Step2
Type the title of your page and close the title with a tag:
Protected Page: Please enter password
Step3
Type the following:
Step10
Close the scripted section of the page by typing the follow: .
Step11
Add a body section for browsers that do not read JavaScript: This page is designed for viewing with Firefox. Please upgrade your browser and return soon!
Step12
Close the Web page by typing: Save the page (for this example, save it as "password.html").
Creating the Error Page
Step1
Open a basic text editing program. Begin by typing the opening tags:
Step2
Title the page "Error" or "Wrong Password":
Sorry ' Wrong Password!
Step3
Type the error message the viewer will see, such as:
I'm sorry, the password you typed is incorrect.
Step4
Give the user an opportunity to re-enter the password: Please
click here to try again. This allows the user the opportunity to return to the password script.
Step5
Allow the user to back out:
Otherwise, click here to return to the main page. ("here.html" indicates the name of the page that links to the protected page)
Step6
Close the page by typing the closing tags:
Testing the Password Script
Step1
Open a Web browser. Select Open from the File menu, locate the page that links to the password-protected page, and click Open to view it.
Step2
Click on the link to the password-protected page.
Step3
You will be prompted for the password. Make sure you enter it correctly; passwords are case-sensitive.
Step4
Gauge the results. If it does not work, go back and double-check that you entered the script correctly.
Finding More Complex Password-Protection Scripts
Step1
Visit pages that offer free JavaScripts and do a search for "password". Many of these scripts are just cut and paste, with minimal changes.
Step2
Protect extremely sensitive information by hiring a Web developer (or your ISP) to create a customized password script for you. These scripts are extremely sensitive and very difficult for hackers.
Step3
Contact your Internet Service Provider and ask if they provide password protection services. This entails setting aside a portion of the server for your pages, so some ISPs may charge extra.
Step4
If you use a free script, add a courtesy button or reference to the provider on your page.
Step5
You may need to get permission before using JavaScripts from another Web site. When in doubt, ask!
Step6
Not all browsers support scripts. Be sure to follow directions for providing alternates to scripts on your Web page.
Comments
denmark said
on 3/11/2008 what happened to this article? parts are missing.
SpainHighlander said
on 12/11/2006 Tried this on my website.
It DOES NOT work !!!!
Not sure why ...but when you type in any word instead of the password, the protected webpage still opens !!
Anonymous said
on 8/8/2006 Instead of using the code: var password = prompt("Enter in the password"""); it should really be: var password = prompt("Enter in the password","");
Please note the comma after the first double quote after "enter password" ... without this comma, the script does not run.
Anonymous said
on 8/3/2006 1. Encrypt page text using password (by javascript), and decrypt it using password provided by visor. Content will be good only when password is correct. Drawback: user with javascript disabled will not be able to see your content.
2. Protect the page on server. I'm using one password protection tool which does it very good. It requires a password only once if you protect fewer pages with same the same password.
Anonymous said
on 3/8/2006 To find out the passwrd : View the source of the document (Right-click on the link > Copy Link Location // Then, in your browser's address bar, type view-source: and press Ctrl+V, then Enter) > Ctrl+F > if(pasword=" > Enter >
You got it.