|
|
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
In my ten-plus months of working with JavaScript, I've encountered about a dozen topics common to most JavaScript programmers. These include how to best work with different versions of Netscape, how to ensure compatibility with Microsoft Internet Explorer, and how to access variables and forms in another frame. This month we'll discuss all this and more.
There are a number of frequently sought solutions that JavaScript can't provide, either because the language is not powerful enough to support it or because it is specifically designed to disallow it (most likely for security or privacy reasons).
How do I use JavaScript to password protect a page?
Only a server can provide true password protection for documents. The typical user authentication used by Unix and NT servers
allows a Webmaster to lock out files and/or directories, requiring a login name and password for access. If an invalid login
name or password is provided, the server refuses access.
In the realm of JavaScript used in an HTML page and interpreted by Navigator or Internet Explorer, there is no sure way to restrict access to a server page, though there is a way to help "hide" a URL to an existing page, and therefore keep out the casual user. You can hard-code a matching password in your JavaScript program, but a slightly more secure method is to use a cipher of some type so that the unlocking password itself is not readily visible in the View Source window. I have an example of how to do this at my JavaScript home page, so I won't repeat it here. The URL is: http://gmccomb.com/javascript/password_doc.html
How do I read and write disk files with JavaScript?
JavaScript is specifically disallowed from any kind of input/output because of security concerns. (Actually, that's not quite
true. JavaScript can use the cookies function of Netscape to store persistent data. However, it is Netscape that controls
the reading and writing of this file, not JavaScript.)
Because JavaScript has no input or output stream capabilities, it is not possible to use it to read a flat-file database or to format a text document and save it to disk. JavaScript is limited to reading and writing the content of standard HTML forms, which can be passed between client and browser if there is a need to exchange data. If you'd like to use JavaScript to write to a file, you must take the long route: fill out a form, use JavaScript to help mail the form, then receive the form via standard e-mail.
How do I use JavaScript to read e-mail names of visitors to my Web page?
The initial release of Netscape 2.0 allowed Webmasters to secretly capture e-mail names of anyone who visited their sites.
This was done by including a form in the page along with a JavaScript submit() instruction for sending the form. The form
was covertly mailed to the Webmaster using an ACTION attribute set to something like mailto:name@server.com.