links2 - a cross platform console based web browser which also renders images

February 12, 2007
Recently, while I was browsing a website in Firefox, I found that it took forever to load the concerned web page. Blame it on my internet connection or on the condition of the web server hosting the web page, I was literally fed up with the wait and closed the window with disgust. It was during this time that I wondered whether it will make my browsing experience a bit more pleasant if I switched to a console web browser such as lynx.

I am aware of a number of web browsers which have a very low memory foot print and also which discard plenty of fluff - which you find increasingly in websites being built now a days - while displaying web pages. Some of these web browsers being Dillo, Lynx and Links. Dillo is a web browser which require an X server to run. But the other two are console web browsers which display only text.

Links2 is a web browser which is based on 'links' and can be run in two modes. It will display web pages only in text when run in console mode and renders images in a variety of graphics formats such as PNG, Jpeg, Gif, Tiff and Xbm when run in graphics mode from within a X window system.

You have to see it in action to actually fathom how it renders the web pages. I have included a couple of screenshots of web pages as viewed in links2 below.

Fig: All about Linux blog rendered in links2.

Fig: Google News page rendered in links2

Fig: Links2 homepage viewed from links2

As you can see from the screenshots, websites which are built using tables are rendered properly where as those which use CSS lose their layout but are still equally readable. This is because links2 does not yet support CSS.

You can install links2 in Debian based Linux distributions by executing the following command :
# apt-get install links2
One of the good things I like about links2 apart from it rendering web pages in the blink of the eye are the number of keyboard shortcuts it supports. Considering that this web browser is also designed to be run in console mode, each and every function can be accessed entirely using the keyboard. Some of the shortcuts I found really convenient are as follows :
  • '\' - toggle between viewing the web page and its source code.
  • '/' - used to search for a word or term in the website that is displayed.
  • [Esc] key - Shows a menu at the top of the browser from which you can also make choices.
  • '=' - Provides further information about the web page such as its size, the web server serving the web page and its url.
  • '|' - Pipe displays the header information.
  • '<- ' - left arrow will take you to the previous view. '->' - right arrow will take you forward to the latest view.
  • [Page up] and [Page down] - these keys can be used to navigate through the web page one page at a time. But you can also use [Space bar] and 'b' key combination for the same.
  • 'g' - will pop-up a dialog box where you can enter the url of the website you want to view. To open this dialog box with the url of the current page already entered, press 'G'.
  • Move the mouse pointer over an image and press 'i' to see only the image.
Features of links2 are varied and many. Some of them being support for javascript, background downloading of files, built in image display for Gif, Jpeg, Xbm, Tiff and Png file formats and built-in fonts in the executable without reliance on any fonts installed in the system just to name a few. You can read the entire list of features at the links2 features page.

Starting links2 in graphics mode
To start links2 in graphics mode which is the mode which displays the images, use the '-g' option with the links2 command :
$links2 -g
The above command will probe all the installed graphics drivers and run on the first found. The drivers that are supported in links2 are x, svgalib, fb, directfb, pmshell and atheos. But if you want to start links2 with a specific driver say driver 'x', pass the value to the '-driver' option as follows :
$ links2 -driver x
links2 also has a lot of other options such as say, you want to save the contents of a webpage to your hard disk. This is easily achieved by using the -dump option as follows :
$ links2 -dump http://news.google.com > news.txt
... which will save the contents of the news.google.com page into the 'news.txt' text file. Which means, using this method you can literally strip all the html elements and save only the text into file. There are a whole lot of command line switches available for links2 from those for changing the foreground and background of the webpage that is viewed to conducting a name lookup of a web address. Check the man page of links2 for more options.

Configuring Links2
As with all things related to Linux and Unix, links2 web browser also stores all its configuration parameters in a text file. If you look into your home directory, you will find a hidden directory called .links2/ which contain all the files pertaining to the user's configuration. It is in the '.links2' directory that links2 web browser stores details such as your bookmarks, the browsing history and the per user configuration details.

The configuration details are stored in the links.cfg text file which is also created in the same location. This file is automatically created by links2 when you make changes to the configuration of the web browser and need not be edited manually by the user. But it is interesting to see the data that is entered in this file. My links.cfg file shows the following details :
# FILE: ~/.links2/links.cfg
# This file is automatically generated by Links -- please do not edit.
async_dns 1
download_utime 0
max_connections 10
max_connections_to_host 8
retries 3
receive_timeout 120
unrestartable_receive_timeout 600
format_cache_size 5
memory_cache_size 1M
image_cache_size 1M
http_proxy ""
ftp_proxy ""
download_dir ""
language "English"
http_bugs.http10 0
http_bugs.allow_blacklist 1
http_bugs.bug_302_redirect 1
http_bugs.bug_post_no_keepalive 0
http_bugs.no_accept_charset 0
http_bugs.retry_internal_errors 0
http_bugs.aggressive_cache 1
http_referer 0
fake_useragent ""
fake_referer ""
ftp.anonymous_password "somebody@host.domain"
ftp.use_passive 0
ftp.fast 0
ftp.set_iptos 1
menu_font_size 16
background_color 14540253
foreground_color 0
scroll_bar_area_color 11184810
scroll_bar_bar_color 0
scroll_bar_frame_color 0
display_red_gamma 2.2000
display_green_gamma 2.2000
display_blue_gamma 2.2000
user_gamma 1.0000
bfu_aspect 1.0000
aspect_on 1
dither_letters 1
dither_images 1
display_optimize 0
gamma_correction 2
enable_javascript 1
verbose_javascript_errors 0
verbose_javascript_warnings 0
enable_all_conversions 1
enable_global_resolution 1
javascript_manual_confirmation 1
js_recursion_depth 100
js_memory_limit 5k
bookmarks_codepage us-ascii
bookmarks_file "/home/octoedge/.links2/bookmarks.html"
extension "aif,aiff,aifc" "audio/x-aiff"
extension "au,snd" "audio/basic"
extension "avi" "video/x-msvideo"
extension "deb" "application/x-debian-package"
extension "dl" "video/dl"
extension "dxf" "application/dxf"
extension "dvi" "application/x-dvi"
extension "fli" "video/fli"
extension "g" "application/brlcad"
extension "gbr" "application/gerber"
extension "gif" "image/gif"
extension "gl" "video/gl"
extension "grb" "application/gerber"
extension "jpg,jpeg,jpe" "image/jpeg"
extension "mid,midi" "audio/midi"
extension "mpeg,mpg,mpe" "video/mpeg"
extension "pbm" "image/x-portable-bitmap"
extension "pcb" "application/pcb"
extension "pdf" "application/pdf"
extension "pgm" "image/x-portable-graymap"
extension "pgp" "application/pgp-signature"
extension "png" "image/png"
extension "pnm" "image/x-portable-anymap"
extension "ppm" "image/x-portable-pixmap"
extension "ppt" "application/powerpoint"
extension "ps,eps,ai" "application/postscript"
extension "qt,mov" "video/quicktime"
extension "ra,rm,ram" "audio/x-pn-realaudio"
extension "rtf" "application/rtf"
extension "sch" "application/gschem"
extension "svg" "image/svg"
extension "swf" "application/x-shockwave-flash"
extension "sxw" "application/x-openoffice"
extension "tga" "image/targa"
extension "tiff,tif" "image/tiff"
extension "wav" "audio/x-wav"
extension "xbm" "image/x-xbitmap"
extension "xls" "application/excel"
extension "xpm" "image/x-xpixmap"
video_driver "x" "1024x675" "" ISO-8859-1
I found this web browser really sleek and easy to use. Considering that it renders graphic images without any problem when run in X windows, this could easily be a good replacement for the mainstream web browsers where one is concerned only in reading the content of a website without the usual distractions such as flash based websites and fancy CSS. Oh yeah, you can also say good bye to most ads you see cluttering websites these days when you use links2.

6 comments:

  • I've been using links and elinks for what feels like an age on old machines. It's great to be able to surf well, even in text mode. I've an old 486-based laptop and links in graphical mode is terrific on this, where even Opera would struggle to perform.

    Good article!

  • That sounds just like what I need. Many thanks!

  • Links2 is a great "lean and mean" browser that does what I need without all the overhead. A web browser with the right balance between too much and too little. I 'm not needing eye candy and animations for alot of what I do on the web.

  • Sam

    I haven't used links2, but I feel the need for "just the facts" on some web pages. Slashdot, for instance, was dog-slow at some locations, and I noticed that it was loading a lot of things from images.slashdot.org. I Adblocked all images from that location and *pow*! It loads a LOT faster now. Almost instantaneous.

    There's something to be said for lean and mean.

  • James

    thanks for the article..what i needed

  • I'm curious. it's said not to support streaming media, like flash, but I see in the included configurations attachment:

    extension "swf" "application/x-shockwave-flash"

    Does this enable flash? If so, are there any other stream stuff that can be plugged?