75

I need to configure my router remotely, and links etc won't work because the router config page uses javascript and refuses to run without it.

Obviously, shame on netgear for being this crap, but is there a text mode browser that will allow their abortion to run?

7 Answers 7

26

Browsh is a modern text-based browser, which runs on the terminal. According to its website, "It renders anything that a modern browser can; HTML5, CSS3, JS, video and even WebGL". It works much better than elinks. It's written in Go, so it's a single executable file, and available on most major platform (Linux, Mac, Windows, etc). (There was also a live demo, which can be accessed via SSH: $ ssh brow.sh but it is currently off-line)

screenshot

2
  • 3
    It's a nice idea, but note that it actually renders using Firefox v57+ which needs to be available. Jan 28, 2022 at 11:22
  • It is cool, has some issues, but works for some things... Jan 16 at 8:21
25

Check which version of elinks you have.

elinks -version
ELinks 0.12pre6 #Not the version that supports ECMAScript

The article "Building eLinks Text-based Web Browser with (Some Sort of) JavaScript Support" describes how to get javascript configured in elinks.

It notes that the resulting version of elinks still doesn't work with lots of web pages, which is perhaps why javascript support is not enabled by default in the elinks version in Ubuntu.

Other even less successful alternatives are noted also: links2 and w3m + w3m-js extension.

A quick summary of the commands for building an elinks that supports ECMAScript follows:

wget http://elinks.or.cz/download/elinks-current-0.13.tar.bz2
tar xjvf elinks-current-0.13.tar.bz2
cd elinks-0.13*
./configure
#Check for ECMAScript support. 
make -j8
sudo make install
6
  • 1
    Note that you need to have libmozjs185-dev package installed, otherwise 0.13 will be no more useful than 0.12pre6 or any other without ECMAScript support. Also, some configuration is necessary to enable ECMAScript. See another answer for details.
    – Ruslan
    Apr 10, 2018 at 14:50
  • It looks like libmozjs185 has been removed from Ubuntu 18.04 Bionic. The packages libmozjs-38-dev and libmozjs-52-dev exist, but the latest master-branch code of elinks won't use them to compile in JS support. It specifically wants mozjs185 or mozilla-js. May 17, 2018 at 15:20
  • 1
    @DavidBaucum see this StackOverflow answer telling how to install it.
    – Ruslan
    Sep 30, 2019 at 10:06
  • your building guide does not work
    – france1
    Dec 7, 2022 at 17:50
  • @france1 Can you be more specific? What did you do, what happened, any error messages?
    – nealmcb
    Jan 9, 2023 at 19:07
23

edbrowse claims to support JavaScript (but I've never used it)

As ed is the standard editor edbrowse may become the standard browser ;-).

2
  • 1
    I tried going down this path; it doesn't appear to be a web browser akin to lynx. It appears to be far more useful if you want to write a script for traversing a website. Apr 20, 2019 at 22:17
  • I have to agree with Brian on this one: Edbrowse isn't a browser, it's a download tool that doesn't seem to be intended for 'surfing'/'browsing'. It doesn't render pages. How much work would it entail to roll duktape into Links or Lynx? Arguably, a text-based browser is the most important software of our time, and we don't have one to show. Apparently Browsh has what you need, but I think it requires X and firefox so it's really just prestidigitation (not really text-based with these requires). And Firefox is malware now (plus like 700 mb of hd space). Feb 1, 2020 at 0:44
14

None of the above answers worked for me out of the box. elinks though is the only one pretty much capable this is what I did:

sudo apt install libmozjs185-dev pkg-config libssl-dev

Very important to have installed pkg-config, without it configure cannot detect SpiderMonkey Javascript engine, without libssl-dev you cannot access HTTPS sites.

wget http://elinks.or.cz/download/elinks-current-0.13.tar.bz2

unpack:

tar xvf elinks-current-0.13.tar.bz2
cd elinks-0.13-20171228/

then configure and check if javascript is seen:

./configure | grep -i "javascript"

Result should be:

ECMAScript (JavaScript) ......... SpiderMonkey document scripting

if result is

ECMAScript (JavaScript) ......... no 

check the steps above until the right result is give.

Then make the sources

make -j8

And install it:

sudo make install

Now enable and try it, by running:

elinks ./test/ecmascript/protocol.html

Press Alt+S, O Key down () and then Space on ECMAScript, Alt+E on Enable change to 1

enter image description here

Alt+V to save and then OK

Now it's able to execute some Javascript.

1
6

There is a good feature comparison table at Linux Journal

1
  • 16
    Would like to point out that presently that article is over 10 years old, from 2005.
    – user1359
    Apr 16, 2016 at 16:07
2

$ chromium --headless --disable-gpu --dump-dom https://javatester.org/javascript.html |html2text

https://softwarerecs.stackexchange.com/questions/11678/text-based-browser-that-runs-javascript/45864?newreg=a9ef2bec71ae4783b6e8ae88e45266c0

3
  • 1
    Cool, but not a browser.
    – Rainb
    May 4, 2021 at 5:27
  • Thanks a lot, this really helped!
    – mrts
    Mar 24, 2023 at 18:10
  • That is the most useful for me.
    – mark
    Apr 21, 2023 at 20:20
1

See this answer: as of v0.23, Web Adjuster has a PhantomJS option, which can partially Javascript-enable any browser with the help of PhantomJS. I say "partially" because it's not (yet?) working with POST forms and Javascript-only links, but it's fine for reading the text of a page which requires Javascript before showing you that text.

sudo apt-get install python-selenium
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-i686.tar.bz2
tar -jxvf phantomjs-2.1.1-linux-i686.tar.bz2 
cd phantomjs-2.1.1-linux-i686/
sudo mv bin/phantomjs /usr/local/bin/
cd ..
sudo apt-get install python-tornado
wget http://ssb22.user.srcf.net/adjuster/adjuster.py
python adjuster.py --PhantomJS --real_proxy

and in another window or tab

http_proxy=http://localhost:28080 lynx http://site-that-needs-javascript.example.com/

Disclosure: Web Adjuster maintainer here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .