Table of Contents
As a user of ELinks, you can control its behaviour by writing scripts in ECMAScript. Unlike scripts in SCRIPT elements of HTML, these user scripts run with all the permissions of your user account, the same as with Lua. The object model is very different too.
Support for ECMAScript user scripts was first added in ELinks 0.11.0.
configure script enables it by default if the required SpiderMonkey
library has been installed, but you can disable it with
--disable-sm-scripting or by editing features.conf.
ECMAScript scripting is still a bit experimental: there seem to be
ways to crash ELinks with it, and the object model may change. However, if
you don't have a
hooks.js file, there is not much risk in enabling the
feature at compile time.
When ELinks starts up, it evaluates the ECMAScript file
your ELinks configuration directory (thus normally
on Unix-like systems), or if the file does not exist there, then in
the system-wide ELinks configuration directory (the location depends
on how ELinks was built, but
/etc/elinks/hooks.js is typical).
In the ELinks source tree, the
contrib/smjs directory contains some
examples about scripting ELinks with ECMAScript. Please see the
README file in that directory for details.
The global object provided to ECMAScript user scripts contains the standard ECMAScript classes, as well as the following:
A reference to the ELinks object.
Compatibility: ELinks 0.11.0