Skip to content

@lelantos-org/sdk / core / toAbsoluteUrl

Function: toAbsoluteUrl() โ€‹

ts
function toAbsoluteUrl(u): string;

Defined in: @lelantos-org/sdk/dist/core/url.d.ts:28

In a browser, resolve a page-relative reference to an absolute URL; anywhere else, and for anything already absolute, return it unchanged.

Self-hosted apps naturally pass a relative artifact base ("/artifacts"). That reference fetches fine but is not an http(s) URL, so without this it fails isHttpUrl and silently loses artifact persistence โ€” a ~29 MB re-download on every page load. Resolving it also gives the byte cache a single canonical key, so two spellings of one artifact cannot produce two downloads and two prover sessions.

Left alone outside a browser: there, a bare string is a filesystem path, and new URL() would corrupt it.

Parameters โ€‹

ParameterType
ustring

Returns โ€‹

string

Lelantosno cookies ๐Ÿช ยท no tracking ๐Ÿ‘๏ธ ยท no accounts ๐Ÿ‘คwalletexplorer4536080GitHub