Next: , Previous: , Up: EWW   [Contents][Index]

2 Basic Usage

You can open a URL or search the web with the command M-x eww. If the input doesn’t look like a URL or domain name the web will be searched via eww-search-prefix. The default search engine is DuckDuckGo. If you want to open a file either prefix the file name with file:// or use the command M-x eww-open-file.

If you invoke eww or eww-open-file with a prefix argument, as in C-u M-x eww, they will create a new EWW buffer instead of reusing the default one, which is normally called *eww*.

If loading the URL was successful the buffer *eww* is opened and the web page is rendered in it. You can leave EWW by pressing q or exit the browser by calling eww-quit. To reload the web page hit g (eww-reload).

Pressing w when point is on a link will call shr-maybe-probe-and-copy-url, which copies this link’s URL to the kill ring. If point is not on a link, pressing w calls eww-copy-page-url, which will copy the current page’s URL to the kill ring instead.

The A command (eww-copy-alternate-url) copies the URL of an alternate link on the current page into the kill ring. If the page specifies multiple alternate links, this command prompts for one of them in the minibuffer, with completion. Alternate links are references that an HTML page may include to point to other documents that act as its alternative representations. Notably, HTML pages can use alternate links to point to their translated versions and to RSS feeds. Alternate links appear in the ‘<head>’ section of HTML pages as ‘<link>’ elements with ‘rel’ attribute equal to ‘``alternate''’; they are part of the page’s metadata and are not visible in its rendered content.

The M-RET command (eww-open-in-new-buffer) opens the URL at point in a new EWW buffer, akin to opening a link in a new “tab” in other browsers. If invoked with prefix argument, the command will not make the new buffer the current one. When global-tab-line-mode is enabled, this buffer is displayed in the tab on the window tab line. When tab-bar-mode is enabled, a new tab is created on the frame tab bar.

The R command (eww-readable) will attempt to determine which part of the document contains the “readable” text, and will only display this part. This usually gets rid of menus and the like.

When called interactively, this command toggles the display of the readable parts. With a positive prefix argument, this command always displays the readable parts, and with a zero or negative prefix, it always displays the full page.

If you want EWW to render a certain page in “readable” mode by default, you can add a regular expression matching its URL to eww-readable-urls. Each entry can either be a regular expression in string form or a cons cell of the form (regexp . readability). If readability is non-nil, this behaves the same as the string form; otherwise, URLs matching regexp will never be displayed in readable mode by default. For example, you can use this to make all pages default to readable mode, except for a few outliers:

(setq eww-readable-urls '(("https://example\\.com/" . nil)
                          ".*"))

The F command (eww-toggle-fonts) toggles whether to use variable-pitch fonts or not. This sets the shr-use-fonts variable.

The M-C command (eww-toggle-colors) toggles whether to use HTML-specified colors or not. This sets the shr-use-colors variable.

The M-I command (eww-toggle-images, capital letter i) toggles whether to display images or not. This also sets the shr-inhibit-images variable.

A URL can be downloaded with d (eww-download). This will download the link under point if there is one, or else the URL of the current page. The file will be written to the directory specified by eww-download-directory (default: ~/Downloads/, if it exists; otherwise as specified by the ‘DOWNLOADXDG directory)).

EWW remembers the URLs you have visited to allow you to go back and forth between them. By pressing l (eww-back-url) you go to the previous URL. You can go forward again with r (eww-forward-url). If you want an overview of your browsing history press H (eww-list-histories) to open the history buffer *eww history*. The history is lost when EWW is quit. If you want to remember websites you can use bookmarks.

By default, when browsing to a new page from a “historical” one (i.e. a page loaded by navigating back via eww-back-url), EWW will first delete any history entries newer than the current page. This is the same behavior as most other web browsers. You can change this by customizing eww-before-browse-history-function to another value. For example, setting it to ignore will preserve the existing history entries and simply prepend the new page to the history list.

Along with the URLs visited, EWW also remembers both the rendered page (as it appears in the buffer) and its source. This can take a considerable amount of memory, so EWW discards the history entries to keep their number within a set limit, as specified by eww-history-limit; the default being 50. This variable could also be set to nil to allow for the history list to grow indefinitely.

PDFs are viewed inline, by default, with doc-view-mode, but this can be customized by using the mailcap (see mailcap in Emacs MIME Manual) mechanism, in particular mailcap-mime-data.

EWW allows you to bookmark URLs. Simply hit b (eww-add-bookmark) to store a bookmark for the current website. You can view stored bookmarks with B (eww-list-bookmarks). This will open the bookmark buffer *eww bookmarks*.

To get summary of currently opened EWW buffers, press S (eww-list-buffers). The *eww buffers* buffer allows you to quickly kill, flip through and switch to specific EWW buffer. To switch EWW buffers through a minibuffer prompt, press s (eww-switch-to-buffer).

Although EWW and shr.el do their best to render webpages in GNU Emacs some websites use features which can not be properly represented or are not implemented (e.g., JavaScript). If you have trouble viewing a website with EWW then hit & (eww-browse-with-external-browser) inside the EWW buffer to open the website in the external browser specified by browse-url-secondary-browser-function. Some content types, such as video or audio content, do not make sense to display in GNU Emacs at all. You can tell EWW to open specific content automatically in an external browser by customizing eww-use-external-browser-for-content-type.

Next: Advanced, Previous: Overview, Up: EWW   [Contents][Index]