Sign in Join
Wiki copytemporary

OpenURL

Definition

Unit: Lazarus lclintf

pascal
function OpenURL(AURL: String): Boolean;

Official documentation: OpenUrl

Description

OpenUrl opens a URL with the default/registered/preferred web browser as specified by the operating system.

Spaces in URLs need to be encoded as %20; see RFC1738. When using the file:// URI scheme, you should not encode spaces with %20.

Warning

On Windows with Lazarus versions older than revision r40490 (2013-03-06), opening a URL using the file:// URI scheme (to open a local file) may fail if there are spaces in the filename.

With those older Lazarus versions, you should enclose the entire string in double quotation marks, if you are on an NT platform.

This is unfortunately system and browser dependant. Note: opening a file:// URL with spaces on Win9x will probably fail if you enclose the URL in quotation marks (See Issue #21659).

On Windows it is preferable to not use OpenUrl with the file:// URI scheme, but use OpenDocument with the filename instead because of the above mentioned problems.

Example

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

See also


From the Free Pascal wiki, page "OpenURL", as it stood on 2021-03-31 after a change by Alextpp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.