Dear Dr. Website®: In your column, CGI was described as a programming language. I thought it was a directory to put programs in. Could you talk about what CGI is? And what are shells?
Well, CGI is a directory...to put CGI programs in.
The directory is usually named "cgi-bin," and developers place their CGI scripts within that directory so that the server can execute a script when a Web page calls it. There is actually no language called "CGI"--as we wrote in the column you're referring to [Sept. 28], CGI scripts can be written in different programming languages, such as Perl or C++. CGI simply stands for Common Gateway Interface.
Shells are found on most beaches. Sorry, couldn't stop ourselves. Actually, shells are kind of like "flavors" or specific user interfaces, for a Unix system, such as Korn, Bourne and C shell (yes, it's actually called the C shell). These shells enable users to create "scripts" using the shell's language, or simply issue commands to the Unix machine. Some people use the word “shell” to refer to any command-line interface with a scripting language, on any operating system, even Windows (via batch files).
Dear Dr. Website®: I want to be able to execute a Perl program before displaying any HTML pages--that is, I want to be able to call a script that will process some data, then send an HTML page when the user types "www.thissite.com", without using JavaScript or the refresh command.
You can indeed call a script in a URL:
http://www.thissite.com/cgi-bin/tricky.pl
for example. For this to work properly, the server's MIME type has to be set up to execute a Perl program, rather than displaying its source, and your cgi-bin directory also has to be set up properly. Usually the site's sysop does these things.
Dear Dr. Website®: Can I make a text hyperlink display without an underline?
Yes--but with a caveat.
You can do it, but to view it properly, your site's visitors will need a fourth-generation browser that understands Cascading Style Sheets (CSS). Luckily, you don't need an entire separate complicated style sheet to get it to work:
<html>
<head>
<style type="text/css">
<!--
.unnamed1 { text-decoration: none; font-style: normal}
-->
</style>
</head>
<body bgcolor="#FFFFFF">
<p>
this is a <a href="http://webdeveloper.com" class="unnamed1">URL</a>
</p>
</body>
</html>
Dear Dr. Website®: How can I use JavaScript to keep users from saving or right-clicking on files (such as copyrighted images), to prevent theft?
Wow, wouldn't that be nice!
Long answer: It can't be done--at least not until the full object model of a browser becomes exposed, letting you control the browser via a program--but at that point, anyone with a browser could still do it. Basically, if you can see it, you can download it, because your browser has already downloaded it into the cache on your machine.
The only real possibility we see here is if someone comes up with streaming graphics files, so that they are viewed, not downloaded, as happens now with RealAudio and RealVideo.
Dear Dr. Website®: I have seen one or two sites with backgrounds that stay in the middle of the screen regardless of any scrolling through the page. How is this done?
This also blew our minds the first time we saw it, and it's very simple.
You add an extra property to the BODY tag, like this:
<body background="images/bkgegypt.gif" bgproperties="fixed">
A Note From the Authors: In response to our Oct. 19 column, a number of readers pointed out--with varying levels of politeness--that we had added unnecessary JavaScript and image pre-loading to our mouseover code. Chalk it up to an overdose of caffeine. As penance, we herewith humbly present the Absolute Minimal Mouseover:
<a href="nextpage.html" onmouseover="image.src='special.gif';" onmouseout="image.src='normal.gif';">
<img name="image" src="normal.gif" alt="nextpage.html">
</a>