Browsers for Command Line Warriors
By Gerry Patterson
Believe it or not some people still use plain text browsers. These can count for as much as half a percent of hits on a site, depending on the nature of the site. The main plain text browsers in use today seem to be lynx, links and w3m. This article compares these three browsers.
I have never taken to the GUI interface with enthusiasm. Pointing devices are essential for manipulating graphical objects. A keyboard, however, remains the best interface for viewing and/or manipulating text. Many websites present information that have a large graphical component. Most of the time, however, the interesting material is contained in HTML text. In cases like this the graphics can be a distraction and a waste of bandwidth. Often the images contain only logos, advertising, or dressing. When I first check a website, I usually go there with lynx. This is a text only browser, which works very well from the system console, and even though it doesn't cope well with Java, frames or graphics, it has a number of good points, namely:
- It has minimal support for Java, frames and graphics.
- It can be run from the system console, and hence does not require X-windows.
- It's very fast, and if you are paying for your bandwidth, economical.
- It is not susceptible to attack from malicious code.
- The view is similar to what a search engine robot sees when it visits a site. Which makes it ideal for checking your own website.
If a site is well put together, and looks as though it might have graphics content that I might find interesting, then I can start X-windows, and visit it with a GUI browser. Quite often a site that is incapable of supporting lynx has been poorly constructed and is likely to exhibit slow response and buggy code. For more about this read KISS Compliant Web Sites.
Judging by other statistics that I have seen published, my site shows a bias towards Unix based browsers which may reflect the content. Without doing a breakdown for Operating system, the statistics for the major browsers at this site are as follows:
Browser Visits (%) Hits (%) ------- ------------ ------------ MSIE 2225 (55.67) 3049 (56.63) Mozilla 735 (18.39) 982 (18.24) Netscape 322 ( 8.06) 428 ( 7.95) Opera 201 ( 5.03) 227 ( 4.22) Galeon 176 ( 4.40) 211 ( 3.92) Other 151 ( 3.78) 93 ( 1.73) Konqueror 145 ( 3.63) 329 ( 6.11) Lynx 15 ( 0.38) 28 ( 0.52) Links 3 ( 0.08) 3 ( 0.06) OmniWeb 3 ( 0.08) 3 ( 0.06) Dillo 3 ( 0.08) 6 ( 0.11) MSNIA 3 ( 0.08) 3 ( 0.06) Crazy Browser 3 ( 0.08) 3 ( 0.06) AvantGo 2 ( 0.05) 6 ( 0.11) Lotus-Notes 2 ( 0.05) 2 ( 0.04) Sqworm 2 ( 0.05) 4 ( 0.07) grub-client 2 ( 0.05) 2 ( 0.04) MSN 2 ( 0.05) 2 ( 0.04) w3m 2 ( 0.05) 3 ( 0.06)
Note: That my site gets a lot of traffic from Open Source related sites and this gives a strong bias towards the Open Source browsers. If I extract just the sites from Google, to give a more representative real world sample, the statistics look like this:
Browser Visits (%) Hits (%) ------- ------------ ------------ MSIE 1259 (81.33) 1316 (81.79) Netscape 101 ( 6.52) 103 ( 6.40) Mozilla 95 ( 6.14) 96 ( 5.97) Opera 32 ( 2.07) 32 ( 1.99) Konqueror 20 ( 1.29) 21 ( 1.31) Other 19 ( 1.23) 19 ( 1.18) Galeon 18 ( 1.16) 18 ( 1.12) MSN 2 ( 0.13) 2 ( 0.12) Crazy Browser 2 ( 0.13) 2 ( 0.12)
In this case, the plain text browsers are missing. Which tends to suggest that these browsers are used by Open Source afficianados. That's Ok, I could be described as an Open Source afficianado myself. Also it should be noted that although 80% of the browsers are MSIE at least half of them (40% of the total) are older versions of MSIE (pre version 6). For more about agent strings read Agent Strings in Popular Browsers.
Lynx is a good browser for users who wish to interact with the operating system from the system console. I find it convenient for composing code. The rendered code can be viewed quickly and easily. Pressing a single key ("e") starts an edit session with your preferred editor. In my case this is vi. The time to wait for an edit session to start or for HTML to be rendered is of the order of 50 milliseconds, which I find acceptable.
Lynx makes minimal effort at rendering tables. The reasoning is that if you really want nice looking tables, you should use a GUI browser. Also it does allow rudimentary support for frames which is a little difficult to navigate, but given the superior performance, it can be worthwhile using it to view sites that use frames. I often use lynx to browse the Oracle Metalink site. Also Lynx does support graphics. It can send image files to an external graphics viewer such as zvg. If it is being run on Xterm it can use Xloadimage.
Because lynx is a very mature browser (probably one of the oldest browsers in the world), it is very stable. It is also immune to malicious code which might attack more sophisticated GUI browsers.
When I first started using lynx I had configured it to use vi compatible keystrokes. Or at least I did after I found where the option setup screen was (press 'o'). However, I later went back to the native keystrokes. I usually find that when a developer offers a compatible set of keystrokes, the compatible option does not receive as much love and care as the native set of commands. Usually it is easier to gain an insight into the intentions of the developer by opting for the native commands, even if it means re-learning some keystrokes. The keystrokes which lynx uses are easy to learn. The one key you need to get started is the "?" key for the help screen.
It's difficult to come up with any genuine complaints about lynx. I still think it is a good way to surf the web, if you do not have time for all the eye-candy and other BS that clutters the Internet aisles. Still if I was going to complain I would say that the output is very rough. However this is not really a complaint. It is a feature! It means that lynx is practically guaranteed to give some form of output as long as there is plain HTML on the page. Lynx almost always works.
Well not quite always, I did come across an example where lynx failed because there was a redirection loop at the start of a URL. Lynx runs around in circles for a while and then terminates in error with the following message:
Whereas w3m (one of the browsers reviewed) appears to work. (see later)Alert!: Redirection limit of 10 URL's reached.
Lynx is the oldest of the plain text browsers. It is also the most well represented. Still, it only accounts for 0.52% of hits. And these figures may be even lower at other sites. If you are a diehard command line hacker, you probably know all about lynx. Because, it has been around for so long, it is even accepted at quite a few sites that employ Browser Sniffing.
However lynx is not the only text-only browser in town. There are some other well known plain text browsers around. As I have recently finished reviewing agent strings (see Agent Strings in Popular Browsers), I thought it would be a good time to trial some of the other plain text browsers. There are two others that have come to my attention. Links, which I have heard is a Lynx clone, accounts for .08% of the hits at my site. Another text browser, w3m, has also been recommended to me. Judging by the statistics from my log files this browser has an even smaller user base. Although, based on my review it deserves better (see later).
As it turned out, I already had a copy of the links browser. It had been installed with the initial Mandrake distribution.
As I said above, I believe the best way to experience the new software is to use the native key-map, if there are alternatives offered. In the case of links, the keystrokes are (mostly) lynx compatible, so I did not have much to re-learn. In any case there did not seem to be alternative maps.
For someone who has grown used to the rude and grungy output from lynx, the layout in links is much slicker. The support for tables looks good. The screen also feels fast. I would have thought that both links and lynx would be using raw rather than cooked termio calls. Nevertheless the links programmers seem to have got a little closer to the metal. Now I probably shouldn't speculate without looking at the source. However, it certainly feels smoother. Sometimes getting closer to the hardware can be a disadvantage, although I did not find any obvious problems.
Initially I thought I did have a problem. I had some difficulty using the mouse. I pressed "g" to go to a new URL, and a high-lighted box popped up. Very flash, I thought (well, Ok we are talking system console here, I'm sure that all you GUI snobs would be underwhelmed by this eighties' technology). However, I could not paste text into this box from another virtual console. Also I couldn't cut text from the links screen. This will be a be a major nuisance, I thought. It turned out that links had been too smart for me. The reason the mouse behaved strangely was that links had detected the mouse and was actually working with mouse support. Unfortunately it was configured for a three button mouse, and my two-button mouse does not emulate three-button support. I did not pursue it further. This would be a giant leap forward! Finally in the 21st Century, I might start using a mouse with my console browser. Ok let's not get too excited.
Like its' older brother, links boasts the ability of passing image files to a viewer such as zgv. This looks like a handy feature, since it would enable previewing graphics files without starting up an X session. Unfortunately I do not have svga installed, so I will have to install it when I get a chance. I will update this review with any information when I do. In fact this feature can be used to pass the file to any application. Also like lynx, the other possibility mentioned in the documentation is Xloadimage, an X-based image viewer. This seems less useful. If I was already in an X session, I would use a GUI browser like Mozilla or Konqueror.
Also I could not get links to work with the oracle Metalink site. Let me first recap on the way that lynx behaves when I visit Metalink. I get an error message that appears as follows:
Links, however does not work at all. Instead I get the following error message:
And I cannot seem to get any further. I have not investigated the problem in detail. However, I thought it might be a user agent string problem. I am not sure if the Oracle site indulges in Browser Sniffing (see Agent Strings in Popular Browsers), but if they do, it might explain this behaviour. Or it could be a bug in the links software. I was testing version 0.96 which is just a BETA release. I would need to do further testing to determine what the actual problem is.401 Authorization Required Authorization Required This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.
Nevertheless I thought I would try cloaking the browser to see if this would help my problem. I spent nearly half an hour searching for where links specifies the user agent string, and I could not find it. In lynx, you can find this in the option screen (by pressing "o"). I tried a web-search to see if I could discover where links might keep this information. Unfortunately the keyword links is not a very distinctive keyword to base a search on. Still if anyone knows how to specify the user agent string, can you drop me a line?
I spent some time trying to figure how links calls an editor to edit a local file. Eventually I resorted to RTFM and found that links is designed to be called by the editor, rather than call the editor. Actually when I think about it, this approach has its' good points.
I would like to find where I can change the user agent string. Not that I want to do this often. But if I ever did, I would like to know where it is. I am sure I could find it with a bit more research, but it should have been a little more obvious.
I may be just grizzling, but I could not find an option to scroll up or down by a half screen. Some equivalent of the "(" and ")" keys in lynx would be handy. Ok, I am just grizzling. After a while I found that Ctrl-N and Ctrl-P move up and down by one line.
Also I found it tedious that I had to type "http://" in front of some URLs (e.g. localhost). There is probably some way to alter this behaviour. But most browsers automatically add an "http://" when the first GET fails.
Pressing "/" takes me into the search mode. This is almost a standard key for searching on unix systems. One annoying feature is that the search does not immediately take me to the first occurrence. It only goes there when the "n" (next) key is pressed. Ok, it's just a niggle. I would get used to it if I was using the software regularly.
Links is a good plain text browser. For lynx users, the transition should be fairly painless. The rendering and mouse support is very good. However, I would be reluctant to cite table and mouse support as a reason for changing to a different text browser. Anyone who feels strongly about rendering tables would stick to a GUI browser.
I liked the layout and the default colours. I also appreciated that links shows italicised text in a different colour. It was the only one of these three browsers which had this capability.
I did not have a copy of w3m, so I had to download it. The build was easy. One of the problems I encountered was building image support which requires something called Imlib. I tried to get the Mandrake distribution to build Imlib and could not find a file called libpng.so.3. I could find binary versions on the Internet, but I could not find how to build it myself. I tried for a while. There seemed to be quite a bit of material about Imlib including security alerts. After a while I gave up. I am not that enthusiastic about graphics support for plain text browsers. W3m built satisfactorily without image support. The configure script is a shell script which asks you questions and stores the results for the next run. It seems Ok and worked quite well on my Linux distribution.
W3m also does a better job of rendering tables than lynx. The keystrokes are vi-compatible. The implementation of vi keystrokes is quite comprehensive and seems to feature most of the common vi navigation commands. This is an advantage for an experienced vi user, who gets off to a good start with a basic set of navigation commands with almost no learning curve. Be warned that the "b" key does not work like vi. That's not really important, but it was the only key that I had to make an effort to re-learn.
The non-vi navigation commands seem to have been chosen with some care to make them mnemonic (e.g. "U" for new URL, "u" to show link URL, "i" to show image URL, "c" to show current URL etc). Considering the limitations of trying to chose meaningful gaps in the vi navigation keys, and considering also that this browser was originally written in Japanese, the care and attention to detail is impressive.
I did not see any of the problems that I observed with links. The browser behaved itself very well. It worked perfectly with the Oracle Metalink site and there were no problems finding where to change the user agent string. When I initially built it, I nominated lynx as my preferred browser. This meant that whenever I pressed the 'M' key the page was sent to lynx. This was very convenient for those few pages that did not look good in w3m. As I have already mentioned, lynx is very grungy but it always works. It just ignores tables and dumps everything out to the screen.
Also I tried w3m with the site that caused lynx to lose its' mind. W3m handled everything it reported the redirection loop:
It then sorts it all out and goes on to display the page. I have withheld the actual name of the URL (they may be under investigation for spamming).Redirection loop detected (http://blah.blah.com/Blah/mainPage.jsp?tab=DC)
I don't really have any complaints about w3m. It is a neat package. Maybe it would be nice to have italics showing in a different colour (like links) And maybe it would be nice to have a sideways scroll that works like '[' and ']' keys in links, rather than the '<' and '>' keys (which move almost a whole half screen). But overall I don't have any real complaints.
I could easily get used to w3m. I have already started to use it in preference to lynx. It is fast, vi-compatible and has rich command set of single key commands that are easy to use. Furthermore with the default browser set to lynx I can call lynx from w3m with a single keystroke. This is for those rare sites that use a table based layout that are awkward to read with w3m.
- The latest release of lynx can be obtained from the lynx home page.
- The links home page contains the manual and latest release.
- The w3m home page is on sourceforge.