|
This is a very basic form of password protection in NOF using JavaScript which does not involve making any changes on the server side, CGI or .htmlsecure. This isn’t 100% foolproof, as you’ll see below..
To make this script work you will need to set up three pages in your NOF site:
- The Pre-Password Page where you will mention that the following page is password protected and where you have a link to the prompt page
- The Prompt Window Page where the viewer will be prompted to type in a password to get to the protected page
- The Protected Page itself - xxx.html where xxx is the password
Click here for the demo
The Pre-Password Page
- In this page, insert the following JavaScript into the “Layout HTML” (aka “Layout Script” in 2.0) window, in the “Between Head Tags” field:
<SCRIPT LANGUAGE = “JavaScript”> <!-- Hide from non JavaScript-Aware Browsers var new_window = null;
function password() { new_window = window.open(‘PROMPT PAGE’, ‘password’, ‘width=xxx, height=yyy’); } // End Hiding --> </SCRIPT> (Don’t put in a carriage return between ‘PROMPT PAGE’ and ‘password’ - that space is there because of page layout limitations!) |
|
|
- Change the text PROMPT PAGE so that it matches the URL of the Prompt Window Page - in the example on this site, the Prompt Window Page is “prompt.html”
- Change xxx to match the width of your Prompt Page Window page, and yyy to match the height of your Prompt Page Window page - If you’re creating the Prompt Page Window Page in NOF, you may want to add 20 pixels to xxx and yyy to ensure there are no “run-offs”
- Create a text or image link object with an External Link - select “javascript” from the drop-down protocal menu and type the following text into the URL field:
The Prompt Page
- In the Prompt Page Window page, insert the following script into the “Between Head Tags” field in the Layout HTML Window (aka “Layout Script” in 2.0)
<script language=”JavaScript”> <!-- Hide from non-JavaScript Aware browsers function check() { var location; var password; password=this.document.passwordform.inputbox.value location = password + “.html” fetch(location) theKeeper=window.close() } function fetch(location) { var root; if (opener.closed) {root=window.open(‘’,’passme’,’toolbar=yes’, ’location=yes,status=yes,menubar=yes,scrollbars=yes, resizable=yes,copyhistory=no’); root.location.href = location; } else { opener.location.href = location; } } // End Hiding --> </script> don´t put any carraige returns between “root” and “copyhistory=no” - that should all be one line. |
|
|
If your Protected Page has the “.htm” extension then you should change the“.html” above to “.htm”
- Create a form (layout, text object or table) on your page and name it “passwordform”
- Create a form input box on your page and name it “inputbox”
- If you’re using NOF 3.0, create a form button of type “Button” and insert the following code into the “Object HTML’s” “Inside Element Tag” field:
onClick=”check(this.form)” |
|
|
If you’re using NOF 2.0, create a text box on your page and insert the following code into the “Element Script’s” “Before Element Tag” field:
<INPUT TYPE=”button” Value=”Submit Password”> |
|
|
The Protected Page
The name of your Protected Page is the Password - in this case, the Password is “target”, since that’s the name of our Protected Page.
You can change the name of the page (and hence, the password), by hitting F12 to get the “Page Properties” window - click on the “Page” tab and enter the new name in the “Name” field.
|