std/browsers
Source EditThis module implements a simple proc for opening URLs with the user's default browser.
Unstable API.
Imports
Consts
Procs
proc openDefaultBrowser() {....deprecated: "not implemented, please open with a specific url instead", raises: [], tags: [], forbids: [].}-
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:
- Under Windows, this will only cause a pop-up dialog asking the assocated application with
about(as Windows simply treatsabout:as a protocol likehttp). - Under Mac OS X the
open "about:blank"command is used. - Under Unix, it is checked if
xdg-openexists and used if it does and open the application assocated withtext/htmlmime (notx-scheme-handler/http, so maybe html-viewer other than your default browser is opened). Otherwise the environment variableBROWSERis used to determine the default browser to use.
This proc doesn't raise an exception on error, beware.
block: openDefaultBrowser()
See also:
Source Edit - Under Windows, this will only cause a pop-up dialog asking the assocated application with
proc openDefaultBrowser(url: string) {....raises: [], tags: [], forbids: [].}-
Opens
urlwith the user's default browser. This does not block. The URL must not be empty string, to open on a blank page seeopenDefaultBrowser().Under Windows,
ShellExecuteis used. Under Mac OS X theopencommand is used. Under Unix, it is checked ifxdg-openexists and used if it does. Otherwise the environment variableBROWSERis 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
© 2006–2024 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/browsers.html