Chapter 14. Scripting ELinks with Lua

Table of Contents

What is it
Where to get it
What it runs on
Installing Lua
Installing ELinks
Running ELinks with Lua
Using ELinks with Lua
ELinks Lua additions
Config file
User protocol
Example recipes
Go to URL on steroids
Expanding ~ (tilde)
Filtering crap
Reading gzipped files
Deferring to Netscape
Alternative bookmark system
More ideas

This file documents the Lua scripting interface of the ELinks web browser.


What is it

Lua scripting capabilities permit users to customize the ELinks behaviour to unusual degree - they allow automatic rewriting of HTML code of the received documents, rewriting of the URLs entered by user etc. You can even write your own bookmarks system with Lua. See also contrib/lua/ for some examples of the possibilities of ELinks Lua support.

Please do not confuse Lua scripting with JavaScript, EcmaScript, VBScript and similar. Those are embedded in page, allowing per-document scripting related to its presentation and providing some degree of interactivity etc. On the contrary, the current Lua support permits scripts to be embedded to the browser directly, changing the behaviour of the browser, not the document.

The original Lua support (in the form of Links-Lua fork of original Links) was written by Peter Wang and Cliff Cunnington. There are some rough edges remaining, but is suitable for everyday use (I have been using it every day for a year).

Where to get it

The Lua scripting support comes with the stock ELinks distribution, no additional patches and tweaks should be needed.

The web site of the original Links-Lua is at Some older patches against regular Links are available at, but they are not being maintained.

Lua can be found at

What it runs on

The Lua support has only been tested under Linux, although it should work under other platforms that ELinks and Lua support (perhaps with some changes to source code?).

Also, note that many of the scripts given here assume a Unix system. Your mileage will definitely vary on other platforms.