OpenURL

From Lazarus wiki
Jump to navigationJump to search

Template:Translate

Definition

Unit: Lazarus lclintf

function OpenURL(AURL: String): Boolean;

Official documentation: [1]

Description

openurl opens an URL with the default/registered web browser as specified by the operating system.

Apparently spaces need to be encoded (as %20); see [2]

Warning-icon.png

Warning: On Windows, opening an URL using the file:// URI scheme (to open a local file) may fail if there are spaces in the filename (you should not escape spaces with %20 in this case).
This is unfortunately system and browser dependant. On "modern" Windows (XP and later) it may help to enclose the entire string in double quotes: "file://some file.htm", whereas this will fail on Win9x systems (See bug 21659 in the bugtracker)

Example

uses 
...
lclintf
...
OpenURL('http://wiki.lazarus.freepascal.org/');