package b0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=00a6868b4dfa34565d0141b335622a81a0e8d5b9e3c6dfad025dabfa3df2db2a1302b492953bbbce30c3a4406c324fcec25250a00b38f6d18a69e15605e3b07e
doc/b0_b00_kit/B00_www_browser/index.html
Module B00_www_browser
Web browser interaction.
Browser shows URIs in the user's browsers. Up to severe platform and browser application limitations it tries to limit the creation of new tabs, reloading existing one which have the same URI or are, if requested, prefixed by the URI.
Environment variables
module Env : sig ... endEnvironment variables.
Show URIs
val find :
?search:B0_std.Fpath.t list ->
browser:B0_std.Cmd.t option ->
unit ->
(t option, string) Stdlib.resultfind ~search ~browser tries to find a browser in a rather complex and platform dependent way.
val show :
background:bool ->
prefix:bool ->
t option ->
string ->
(unit, string) Stdlib.resultshow ~background ~prefix browser uri shows URI using browser browser (if None an error message is returned mentioning that no browser was found. If background is true tries to keep the browser application in the background, if false brings it in user focus.
The function tries to limit the creation of new tabs using the following strategy:
Repeat from the frontmost browser window to the backmost one until a tab to reload is found:
- If the window's current tab's URI is
uri(or is prefixed byuriwhenprefixistrue), reload this tab. - If the window has one or more tab whose URI is
uri(or is prefixed byuriwhenprefixistrue), pick the left most one, make it current in the window and reload it.
- If the window's current tab's URI is
- If no tab was found, get the frontmost window. If the current tab has no URI, use that tab with
uriotherwise create a new tab withuriand make it current for the window.
Cli interaction
val browser :
?docs:string ->
?opts:string list ->
unit ->
B0_std.Cmd.t option Cmdliner.Term.tbrowser is an option and BROWSER environment variable to use with the browser argument of find. opts are the cli options and default to ["browser"].
prefix is option to use the with prefix argument of show. opts are the cli options and default to ["prefix"].