std/browsers (original) (raw)

Source Edit

This module implements a simple proc for opening URLs with the user's default browser.

Unstable API.

Procs

proc openDefaultBrowser() {....deprecated: "not implemented, please open with a specific url instead", raises: [], tags: [], forbids: [].}

Deprecated: not implemented, please open with a specific url instead

Intends to open the user's default browser without any url (blank page). This does not block. Intends to implement IETF RFC-6694 Section 3, ("about:blank" is reserved for a blank page).

Beware that this intended behavior is not implemented and considered not worthy to implement here.

The following describes the behavior of current implementation:

This proc doesn't raise an exception on error, beware.

block: openDefaultBrowser()

See also:

proc openDefaultBrowser(url: string) {....raises: [], tags: [], forbids: [].}

Opens url with the user's default browser. This does not block. The URL must not be empty string, to open on a blank page see openDefaultBrowser().

Under Windows, ShellExecute is used. Under Mac OS X the open command is used. Under Unix, it is checked if xdg-open exists and used if it does. Otherwise the environment variable BROWSER is used to determine the default browser to use.

This proc doesn't raise an exception on error, beware.

block: openDefaultBrowser("https://nim-lang.org")

Source Edit