EWW normally uses url-retrieve
to fetch the HTML
before rendering it, and url-retrieve-synchronously
when
the value of eww-retrieve-command
is sync
. It can
sometimes be convenient to use an external program to do this, and
eww-retrieve-command
should then be a list that specifies
a command and the parameters. For instance, to use the Chromium
browser, you could say something like this:
(setq eww-retrieve-command '("chromium" "--headless" "--dump-dom"))
The command should return the HTML on standard output, and the data should use UTF-8 as the charset.
You can view the source of a website with v
(eww-view-source
). This will open a new buffer
*eww-source* and insert the source. The buffer will be set to
html-mode
if available.
EWW handles cookies through the (url)url package
package. You can list existing cookies with C
(url-cookie-list
). For details about the Cookie handling
See (url)Cookies.
Many HTML pages have images embedded in them, and EWW will
download most of these by default. When fetching images, cookies can
be sent and received, and these can be used to track users. To
control when to send cookies when retrieving these images, the
shr-cookie-policy
variable can be used. The default value,
same-origin
, means that EWW will only send cookies when
fetching images that originate from the same source as the
HTML page. nil
means “never send cookies when
retrieving these images” and t
means “always send cookies
when retrieving these images”.
When following links in EWW, URLs that match the
eww-use-browse-url
regexp will be passed to browse-url
instead of EWW handling them itself. The action can be further
customized by altering browse-url-handlers
.
The header line of the EWW buffer can be changed by customizing
eww-header-line-format
. The format replaces %t
with the
title of the website and %u
with the URL.
The D command (eww-toggle-paragraph-direction
) toggles
the paragraphs direction between left-to-right and right-to-left
text. This can be useful on web pages that display right-to-left test
(like Arabic and Hebrew), but where the web pages don’t explicitly
state the directionality.
Loading random images from the web can be problematic due to their
size or content. By customizing shr-max-image-proportion
you
can set the maximal image proportion in relation to the window they
are displayed in. E.g., 0.7 means an image is allowed to take up 70%
of the width and height. If Emacs supports image scaling, then larger
images are scaled down. You can block specific images completely by
customizing shr-blocked-images
.
You can control image display by customizing
shr-inhibit-images
. If this variable is nil
, display
the “ALT” text of images instead.
EWW (or rather its HTML renderer shr
) uses the colors declared
in the HTML page, but adjusts them if needed to keep a certain minimum
contrast. If that is still too low for you, you can customize the
variables shr-color-visible-distance-min
and
shr-color-visible-luminance-min
to get a better contrast.
By default, the max width used when rendering is 120 characters, but
this can be adjusted by changing the shr-max-width
variable.
If a specified width is preferred no matter what the width of the
window is, shr-width
can be set. If both variables are
nil
, the window width will always be used.
The HTML attribute aria-hidden
is meant to tell screen
readers to ignore a tag’s contents. You can customize the variable
shr-discard-aria-hidden
to tell shr
to ignore such tags.
This can be useful when using a screen reader on the output of
shr
(e.g., on EWW buffer text). It can be useful even when not
using a screen reader, since web authors often put this attribute on
non-essential decorative elements.
In addition to maintaining the history at run-time, EWW will also save the partial state of its buffers (the URIs and the titles of the pages visited) in the desktop file if one is used. See Saving Emacs Sessions in The GNU Emacs Manual.
EWW history may sensibly contain multiple entries for the same page
URI. At run-time, these entries may still have different associated
point positions or the actual Web page contents.
The latter, however, tend to be overly large to preserve in the
desktop file, so they get omitted, thus rendering the respective
entries entirely equivalent. By default, such duplicate entries are
not saved. Setting eww-desktop-remove-duplicates
to nil
will force EWW to save them anyway.
Restoring EWW buffers’ contents may prove to take too long to
finish. When the eww-restore-desktop
variable is set to
nil
(the default), EWW will not try to reload the last visited
Web page when the buffer is restored from the desktop file, thus
allowing for faster Emacs start-up times. When set to t
,
restoring the buffers will also initiate the reloading of such pages.
The EWW buffer restored from the desktop file but not yet reloaded
will contain a prompt, as specified by the
eww-restore-reload-prompt
variable. The value of this variable
will be passed through substitute-command-keys
upon each use,
thus allowing for the use of the usual substitutions, such as
\[eww-reload]
for the current key binding of the
eww-reload
command.
If the eww-auto-rename-buffer
user option is non-nil
,
EWW buffers will be renamed after rendering a document. If this is
title
, rename based on the title of the document. If this is
url
, rename based on the URL of the document. This
can also be a user-defined function, which is called with no
parameters in the EWW buffer, and should return a string.
EWW runs the URLs through eww-url-transformers
before using
them. This user option is a list of functions, where each function is
called with the URL as the parameter, and should return the (possibly)
transformed URL. By default, this variable contains
eww-remove-tracking
, which removes the common ‘utm_’
trackers from links.
If Emacs has been built with xwidget support, EWW can use that to
display ‘<video>’ elements. However, this support is still
experimental, and on some systems doesn’t work (and even worse) may
crash your Emacs, so this feature is off by default. If you wish to
switch it on, set shr-use-xwidgets-for-media
to a
non-nil
value.