Friday 12/16/05
If you use the Squid proxy server, you may have been maddened by its refusal to automatically go to www.foo.com if you enter just foo (assuming foo isn't a hostname in your default domain). An easy workaround is to edit the file ERR_DNS_FAIL (you'll have to search for this; if you are using SquidMan on a Mac, the English version of this page is in /usr/local/squid/share/errors/English). Just after the line that begins <HEAD>, insert the following code:
<SCRIPT LANGUAGE="JavaScript1.1" TYPE="text/javascript"><!--
var url ="%U";
var url_array = url.split("/");
if(url_array[2].indexOf(".") < 0) {
url_array[2] = "www." + url_array[2] + ".com";
location.replace(url_array.join("/"));
}
// --></SCRIPT>
Sick and depraved, perhaps, but it does the job.
While I was at it, of course, I fixed the maddening message "Check if the address is correct" to read "Check the address to make sure it is correct."
Why am I running a Squid proxy on my Mac? First, so I don't waste disk space on caches for different browsers -- I disable the disk cache in each browser and they all use the Squid cache. Second, so when I'm ssh'd to my Mac from my laptop, I can use the Squid proxy from the laptop for secure browsing -- handy when you're using an open wireless hotspot.
To replicate Firefox's behavior (doing a Google "I'm feeling lucky" search rather than simply adding www and com), try this instead:
<SCRIPT LANGUAGE="JavaScript1.1" TYPE="text/javascript"><!--
var url ="%U";
var url_array = url.split("/");
if(url_array[2].indexOf(".") < 0) {
location.replace("http://www.google.com/search?q=" + url_array[2] + "&btnI=I'm+Feeling+Lucky")
}
// --></SCRIPT>
aspcomments2 by Jerry Kindall
based on aspcomments by sneaker