Sign in Join
Wiki copytemporary

OpenURL: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: OpenURL

OldNewLine
1+## Definition
2+
3+Unit: Lazarus **lclintf**
4+
5+``` pascal
6+function OpenURL(AURL: String): Boolean;
7+```
8+
9+Official documentation: [OpenUrl](http://lazarus-ccr.sourceforge.net/docs/lcl/lclintf/openurl.html)
10+
11+## Description
12+
13+`OpenUrl` opens a URL with the default/registered/preferred web browser as specified by the operating system.
14+
15+Spaces in URLs need to be encoded as %20; see [RFC1738](http://www.ietf.org/rfc/rfc1738.txt). When using the <file://> URI scheme, you should not encode spaces with %20.
16+
17+## Warning
18+
19+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.
20+
21+With those older Lazarus versions, you should enclose the entire string in double quotation marks, if you are on an NT platform.
22+
23+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](https://bugs.freepascal.org/view.php?id=21659)).
24+
25+On Windows it is preferable to not use `OpenUrl` with the <file://> URI scheme, but use [[opendocument|OpenDocument]] with the filename instead because of the above mentioned problems.
26+
27+## Example
28+
29+``` pascal
30+uses
31+...
32+lclintf
33+...
34+OpenURL('https://wiki.lazarus.freepascal.org/');
35+```
36+
37+## See also
38+
39+- [[opendocument|OpenDocument]]
40+- [[macOS Open Sesame|macOS open]]
41+
42+---
43+*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](/wiki-contact).*
44+Category: Inter-process communication
45+Category: Lazarus
46+Category: lclintf

Back to history