Documentation
On this page

Function · Desktop Services

openExternal

Opens a URI or file with the operating system's default application.

@sharpts/gui · SharpTS 572a2e31be0e

Signature

TypeScript
openExternal(target: string): Promise<void>

Parameters

NameTypeDescription
targetstringURI or file path to open.

Returns

Promise<void> — A promise completed after the native open request is submitted.

Remarks

Absolute HTTP, HTTPS, and mailto URIs are accepted directly. Other values must resolve to an existing file or directory relative to the application directory.

Throws

  • When the target is empty, a local path does not exist, or the operating system cannot launch its registered handler.

Examples

TypeScript
import { openExternal } from "@sharpts/gui";

await openExternal("https://sharpts.dev/docs");

Source

src/SharpTS.Gui.Sdk/GuiPackage/runtime.ts:1700 at SharpTS revision 572a2e31be0e2a09be0138bc44501b34d6245b51.