% This LaTeX document was generated using the LaTeX backend of PlDoc, % The SWI-Prolog documentation system \section{library(www_browser): Open a URL in the users browser} \label{sec:wwwbrowser} This library deals with the highly platform specific task of opening a web page. In addition, is provides a mechanism similar to \predref{absolute_file_name}{3} that expands compound terms to concrete URLs. For example, the SWI-Prolog home page can be opened using: \begin{code} ?- www_open_url(swipl(.)). \end{code} \vspace{0.7cm} \begin{description} \predicate{www_open_url}{1}{+Url} Open URL in running version of the users' browser or start a new browser. This predicate tries the following steps: \begin{enumerate} \item If a prolog flag (see \predref{set_prolog_flag}{2}) \const{browser} is set and this is the name of a known executable, use this. The flag may be set to \verb$Command-Mode$, where mode is one of \const{fg} or \const{bg}, requesting Command to run in foreground or background mode. Default is \const{bg}. \item On Windows, use \verb$win_shell(open, URL)$ \item Find a generic `open' comment. Candidates are \verb$xdg-open$, \const{open} or \verb$gnome-open$. \item If a environment variable \verb$BROWSER$ is set and this is the name of a known executable, use this. \item Try to find a known browser. @tbd Figure out the right tool in step 3 as it is not uncommon that multiple are installed. \end{enumerate} \predicate[multifile]{known_browser}{2}{+FileBaseName, -Compatible} True if browser \arg{FileBaseName} has a remote protocol compatible to \arg{Compatible}. \predicate{expand_url_path}{2}{+Spec, -URL} Expand \arg{URL} specifications similar to \predref{absolute_file_name}{3}. The predicate \predref{url_path}{2} plays the role of \predref{file_search_path}{2}. \begin{tags} \tag{Errors} \verb$existence_error(url_path, Spec)$ if the location is not defined. \end{tags} \end{description}