GNU Emacs
Emacs
Dashboard

46.3 Following URLs

M-x browse-url RET url RET

Load a URL into a Web browser.

The Browse-URL package allows you to easily follow URLs from within Emacs. Most URLs are followed by invoking a web browser; ‘ mailto:’ URLs are followed by invoking the compose-mail Emacs command to send mail to the specified address (see Sending Mail).

The command M-x browse-url prompts for a URL, and follows it. If point is located near a plausible URL, that URL is offered as the default. The Browse-URL package also provides other commands which you might like to bind to keys, such as browse-url-at-point and browse-url-at-mouse.

You can customize Browse-URL’s behavior via various options in the browse-url Customize group. In particular, the option browse-url-mailto-function lets you define how to follow ‘ mailto:’ URLs, while browse-url-browser-function specifies your default browser.

You can define that certain URLs are browsed with other functions by customizing browse-url-handlers, an alist of regular expressions or predicates paired with functions to browse matching URLs.

For more information, view the package commentary by typing C-h P browse-url RET.

Emacs also has a minor mode that has some support for handling URLs as if they were files. url-handler-mode is a global minor mode that affects most of the Emacs commands and primitives that deal with file names. After switching on this mode, you can say, for instance, C-x C-f https://www.gnu.org/ RET to see the HTML for that web page, and you can then edit it and save it to a local file, for instance.