Tuesday, June 3, 2014

Hypertext Browsing

I tend to browse the web using Firefox with some basic plugins, which probably is true for most people (Chrome, Safari, etc...).  It's overkill for a lot of things though.  A lot of the time, all I really need is a way to enter a URL, render some text, search for some text, follow links, and possibly enter text into forms.  All of these can be done with a slightly simpler browser, w3m.

If you are resource constrained, you prefer working strictly with text, or you don't have access to a graphics environment, w3m can come in handy.  The footprint is a few orders of magnitude less than the graphical variants, and it's meant for keyboard navigation.

The motions are probably familiar to anyone who's used Vi/Vim before.

<h>- left
<j>- down
<k>- up
<l>- right
<w>- next word
<^>- line start
<$>- line end

Directional keys can also be used.  Navigating links and input fields is generally the same as the graphical browsers.

<tab>- next field
<s-tab>- previous field

Instead of the mouse, w3m gives a menu for links, which can be slightly faster than using a mouse (see Fitts' Law).

<esc-m>- link list (move)
<esc-l>- link list (follow)

Another easy way to navigate is searching for text.  Again, Vi/Vim users will probably recognize the default key bindings.

</>- search forward
<?>- search backward

Last, to open new URLs and tabs...

<U>- open URL
<T>- new tab

There are more complex combinations, but the above should be a good start.  The full set of navigation and configuration options can be found in the man page as well as the help screen (<H>).

Putting it all together...


One of the things I've found w3m is good for is as a basic interface for things that have a form of HTTP/HTML API.


It's admittedly limited, depending on the protocol or features sites you try to browse rely on.  Support for more recent protocols (SPDY, HTML5, AJAX, etc...) is decidedly lacking.

Although, on the development side, it's also useful for a number of things like navigating doxygen/javadoc, parsing jhat output, and even browsing wikipedia.


It's also useful to work with from the command line.

~ watch -n 10 w3m http://www.wrh.noaa.gov/sew -dump

I combine it with other things like tmux, mutt, vim and emacs which makes it a little more useful, but the above are some of the basics.

Downloads, documentation, etc... can be found on w3m's homepage for anyone curious.