The Wayback Machine - https://web.archive.org/web/20120813195526/http://omniplex.om.funpic.de/lab.htm
xyzzy

Laboratory

Contents:
Googlecalculator, 2 Faveletsscripts, 3 Netscape 2.02isindex.

On this page you'll find some XHTML experiments. See also pages with XHTML colours, browser compatibility tests, codepage 858 characters, some GeoURL experiments, or visit the complete site map.


top   1 - Google search

For the calculator and spam reports use the simple search
Google

Google's free site search is nice, but the generated HTML form is far from optimal. I had to modify it anyway to get valid XHTML. If you want to modify your own customized site search form, here are some details:

  1. The FAQ states that there are no back links in a free search form. This is incorrect, your logo "hides" a back link specified by e.g.  S:http://purl.net/xyzzy/bookmark.htm  in the hidden  name="cof"  input parameter value. The S:-part (Site) of its value is the URL of the back link.
  2. The search form generator allows either div align=left or center specified by AH:left or AH:center. In fact AH:right is also okay. IMHO the result is ugly whatever you do, because you can't align the logo width LW: with the top search form on the result page, although both are contained in the same div as specified by AH:. Google doesn't accept LW:100% or LW:100%25 etc. :-(
  3. Google uses the actual <input type="hidden" name="cof" value="..." /> parameter of the query to display its search result. The original value is stored for later modifications of the generated form, but apparently otherwise not used.
    New 2005 observation, apparently the free site search now also works without registered AWFID: string. Update 2007, the old free site search was abandoned in favour of the new custom search engines, old stored site search layouts might be lost.
  4. You can omit domains in the generated <input type="hidden" name="domains" value="..." />. In my form I generated and actually use dmoz.org, w3.org, and ietf.org, but submit only one &domains= parameter in the query. The effect is a smaller and less confusing search form on the result page. You could even use domains rejected by Google's form generator like TLD edu. Google's search result then displays Searched the Web , but <input type="radio" name="sitesearch" value="edu" /> would work as expected.
  5. Semantically the radio buttons to select a domain form a <fieldset>, but unfortunately Lynx (version 2.8.5) then displaid these buttons in a separate line. In the current layout the last line contains only radio buttons, and Lynx can handle this. It still has a serious problem with the <caption>, which should be handled like a separate row or column. Sorry, I found no solution for this issue.
  6. A part of the deal is that you use an official Google logo linked to Google. I used the smallest available 56×20 logo (instead of the bigger logo in the generated form) with a link to Google's site map (instead of its homepage). AFAIK you're not allowed to copy any logo, maybe because Google sometimes uses a special logo of the day. Probably this only affects bigger logos, I've never seen a special 75×32 or 56×20 logo.
    Please note that this could be a privacy issue. Almost all visitors of a page with Google's customized site search will load the logo, and in theory Google could note their IP. In practice I don't even know what my own ISPs do with the IPs of my visitors... :-|
  7. It's possible to use two search parameters &as_ft=e (exclude) and &as_filetype=pdf to exclude PDF-files. But for a checkbox one parameter &as_eq=filetype:pdf has the same effect. I've used a similar checkbox &eq=group:news.admin.net-abuse.sightings for simple exclusions in my net-abuse form. This won't work in combination with a link: or define: search, therefore I now only offer no PDF as an option.
  8. Google supports a special parameter name="meta" value="expression", where "expression" is something like "as_ft=e;as_filetype=pdf". A better idea for meta is to combine a sitesearch with the corresponding domains in a single radio button, e.g. <input type="radio" name="meta" value="sitesearch=ietf.org&amp;domains=ietf.org" />. Multiple domains would be separated by semicolons, therefore use meta values like "sitesearch=...&amp;domains=..." in this order.
  9. Apparently &restrict=lang_de and combinations of lr with restrict are not more supported. Now I use &meta= with value "lr=lang_de" in the de search or "lr=lang_en|lang_de" in the WWW search, where I don't need any domains.
  10. The checkbox for only last year corresponds to parameter &as_qdr=y. This has also a side-effect on the search form of the result, if checked a selection of optional date ranges (past year etc.) is shown. All as_ parameters are advanced search features not necessarily designed to work with customized searches, and of course Google is free to modify undocumented features without prior notice.
  11. Normally I wouldn't force a visitor to use "my" colours, but Google doesn't allow to use whatever default colours. If you don't define BGC: (BackGround Colour), LC: (Link Colour), VLC: (Visited Link Colour), ALC: (Active Link Colour), GIMP: (? IMPortant), GFNT: (ditto FaiNT), GALT: (ditto ALTernative), and T: (Text), you'll get Google's colours. At least you can omit BIMG: (Background IMaGe).
  12. For some years GL:3 (Google Logo background colour) doesn't work anymore, now GL:1 results in a gray #bbbbbb background, while GL:0 (the default) is white, and GL:2 is black. I'd need #cccccc to match BGC:#cccccc, but white is also okay.
  13. Whatever &ie=UTF-8&oe=UTF-8 might do, I'm sure that my old Netscape 2.02 doesn't like it, therefore I picked &ie=windows-1252&oe=windows-1252. Yes, this is a IANA-registered MIME-compatible charset, it's simply Latin-1 replacing 27 control charcters by printable characters.

top   Calculator

Query string Simple Customized
99 inches in rods test test
2 stones in oz test test
12 pounds in troy oz test test
imperial ton/35 in oz test test
days*horsepower/psi test test

Unfortunately nice Google features like the calculator don't work with its customized free site search. The site search URLs are very long, therefore I created a shorter PURL for my AWFID with hardwired parameters &as_qdr=y and &lr=lang_en. This results in the new customized search form for &lr= instead of any &domains= parameter.

Hint: Spaces in PURL redirections of the site search (3rd column) are encoded as %2520 instead of the usual %20.

After the introduction of "custom search engines" the old "free site search" is now mostly obsolete, but some parameters like AH can be still relevant. I'll collect my "Googlets" including custom search engines on a separate site hosted by Google.

Related links: Google official blog, sitemaps blog, friends newsletter.


top   2 - Favelets

Favelets (aka Bookmarklets) are snippets of JavaScript code in the form of a JavaScript URL. Normally JavaScript URLs, i.e. links determined by JS, are a bad idea, because they won't work in browsers without JavaScript, or if the user has disabled JS. There's also the question of the JS version, Netscape 3.x (incl. OS/2 Netscape 2.02) supports only JavaScript 1.1, and features of later JS versions throw syntax errors like hell in old browsers. Well designed web sites don't rely on scripts, frames, plugins, applets, or style sheets.

But if JS is only used as an additional option, it offers some nice features. The idea with favelets is to bookmark these links, and later apply their code on any actual document. Therefore a favelet typically does something with document.URL or window.location.href, e.g. submit it to another site for validation, or it displays or modifies document properties like document.bgColor.

JS links have the form <a href="javascript:expression">, where expression is evaluated by JS returning void or a string (?). Apparently strings are simply displayed, to change the location use void(location=URL). Here's an example using Netscape's special view-source:
void(location='view-source:'+location).

And the next time somebody tries nonsense like white on white or black on black simply force a silver background. Testing a small favelet like this is easy, input its URL mocha:void(document.bgColor='silver') in the location line. Other browsers probably insist on javascript: instead of mocha:.

A tricky part with favelets is to nest the quotation marks appropriately. One level "..." is used by the href-value, i.e. the complete JS link. The second level '...' can be used for JS strings within the expression. I haven't found a clean way for more levels like XHTML attribute value strings within JS strings. A rather clumsy workaround used in document.lastModified is 'value='+unescape('%22')+document.lastModified+unescape('%22').

This was an example with more than one JS statement, a simpler solution could use function alert as in
alert(document.lastModified+unescape('%0A')+document.URL). Please edit the title of bookmarked favelets before moving them to a subfolder, Netscape 2.02 creates but later can't manage complex titles... :-(

Use escape(location) to encode an URL as parameter of another URL like the W3C Link Checker: void(open('http://validator.w3.org/checklink?url='+escape(location))). Here void(open(URL)) instead of void(location=URL) opens a new browser window.

In Jesse's bookmarklets I found a nice and simple favelet to query links to the current page listed by Google:
location='http://www.google.com/search?q=link:'+escape(location);
The source works with many browsers, but for JS 1.1 and Netscape 3.x add void() and maybe strip www and the trailing semicolon:
void(location='http://google.com/search?q=link:'+escape(location)).

Now I was almost ready to delete this section as "ancient history", but it might still help in some special situations, not limited to the Mozilla 3 community - is there anybody ot there? ecmanaut has posted a recipe to upload files from the command line to google pages. The very first thing it needs is the session cookie, and you can get it with a simple favelet:
javascript:void prompt('Cookies:',document.cookie)

top   Scripts

Some snippets for those of us hating JavaScript and its incompatibilities, please don't forget to declare the script type for event handlers like onload in the <head> section of XHTML pages:

  <meta http-equiv="Content-Script-Type" content="text/javascript" />

Get rid of foreign framesets in the <body> tag:

  onload="if (parent.location != location) parent.location = location"

For external links not working with JavaScript 1.1:

  onclick="return confirm('JavaScript 1.1 won'+unescape('%27')+'t work')"

General JavaScript warning, but this could annoy visitors:

  onclick="alert('JavaScript enabled: external links could be unsafe')"

Replace ugly frameset enforced by foreign JS (\nsome wrapped):

  onload="if (parent.location == location )
  if ( confirm('Empty frameset required for JavaScript because\n
                some links otherwise force a monster frameset.'))
  window.location.replace('demo.html')"

Corresponding demo.html body with demo.htm frame:

  <frameset rows="*,"><frame src="demo.htm" /><noframes><body>
  Insert explanation for curious Lynx users and Googlebot
  </body></noframes></frameset>

The frameset trick is also known as cloaking, please don't use it for normal pages. Links to other pages - i.e. not affected by the ugly frameset enforced by a foreign JavaScript - should contain a target="_top" attribute. Otherwise you would trap these pages in your frameset, and that's at least annoying and maybe even illegal.

Related links: W3C favelets, FAQ by favelets.com, Jesse's bookmarklets, Jargon Googlet.


top   3 - Netscape 2.02

Netscape 2.02 for OS/2 is in fact a Netscape 2.x GUI over a Mozilla 3.x engine. I have removed all Netscape 4.x links, because I don't intend to use this infamous version. Of course mozilla.org still offers its monstrous Mozilla 1.x, but it's somewhat larger than the decent 2.8 MB of a fortified Netscape 2.02 binary.

The latter view-source:about:global apparently decodes the file netscape.hst, nice if you have forgotten to bookmark an interesting site. Netscape 2.02 doesn't know about.config, and probably only OS/2 versions support about:ibmlogo, so now is the time to hex. view an unpacked Netscape binary and... have fun ;-)

top   <isindex>

Another obscure Netscape feature is the <isindex> tag. This deprecated (obsolete) element used in the <head> section of documents was roughly equivalent to a <form action="#" > with one <input type="text" /> field sending queries to the current URL.

Normal form fields associate a name with a value resulting in a name=value parameter for the default method="get". <isindex> however knows that there is only one parameter, and sends a simplified ?value  query instead of something like ?name=value . So far this is only an obsolete Mosaic feature, because it would be a pain to modify the action (query) URL with <base href="URL" />. But Netscape uses the same simplified queries for all forms with exactly one text input field, if its name is isindex.

Check out the following example echoed by Delorie's Request Viewer: . You could add a submit button without name attribute. Named submit buttons won't work, because this results in a second parameter, and then Netscape would again send the conventional ?isindex=value &name=Submit+Query in the case of its default submit button value.
<form action="gopher://dict.org:2628/?DEFINE%20*%20"> won't work with name="isindex", because Netscape then replaces ?DEFINE%20*%20 by ?query. With a redirected URL gopher at port 2628 and name="isindex" can emulate dict://dict.org/d/query:* as specified in RfC 2229  for single words resulting in  ?DEFINE%20*%20?xyzzy, example:
    
   <form action="http://purl.net/net/scape/dict/">
   <input type="text" name="isindex" value="xyzzy" size="11" />
   <input type="submit" value="dict.org" /></form>
top  IBM WebExplorer also knows this name="isindex" feature, but Lynx doesn't support it.
W3 validator Last update: 21 May 2007 19:00 by F.Ellermann