Lynx Browser: How to make a Meta Refresh (reload page)!
07/16/2019 (5962x read)
Lynx is a small and practical text browser: It is available for Linux and Raspbian among other systems and can also be started from the command prompt. It then displays web pages, but without images. This can be useful, for example, to execute scripts on your own web server or in the Smart Home. It can also be used to easily load data from web pages and extract the content without having to open the page in a „big“ browser like Firefox.
lynx https://www.computerhilfen.de
Further options for the browser can be found in the man pages or with the call lynx -h.
Meta-Refresh with lynx
The Lynx browser does not support meta refresh: Even in the latest versions, you cannot use this automatic redirection directly in the head of the HTML file with the Lynx browser: Lynx simply ignores the statement. But you can work around the problem and still reload the page automatically! Here we show three ways to replace the Meta-Refresh as best as possible!
Use the w3m Browser
The free w3m browser is, just like lynx, a small text browser for Linux. It is just as easy to install and use. In the standard configuration it does not support meta refresh, but this can be activated in the settings. Here we show you how to load w3m and how to activate the Meta Refresh in w3m.
Use a PHP refresh
Instead of the automatic refresh via meta tag you can reload the page also with PHP: The advantage of this solution is that the redirection takes place directly on the server: You are not dependent on the browser. But there is also a disadvantage: The PHP redirect is defined in the header of the page: To sent the header, no output may take place before. The script can load and save data, but must not send anything to the browser (not even a whitespace or the HTML head): Only then the PHP forwarding will work!
<?php header("Location: http://computerhilfen.de"); ?>
Use a cronjob
This option bypasses the unsupported meta refresh by simply repeating the Lynx browser call. The browser is restarted with the page to be loaded by a cronjob. In contrast to the PHP redirection, you can also specify how many time (in minutes) should elapse between the meta refresh. However, this variant does not work if you refer to a second website via redirection: This only helps to reload the same website over and over again.
To start the actual user’s cronjob editor, type „crontab -e“ in the Linux console.
Cronjob once per minute:
* * * * * * lynx https://www.computerhilfen.de