Home

baseuri

baseURI refers to the base Uniform Resource Identifier used to resolve relative URLs within a document. It represents the absolute URL against which any relative links, scripts, images, and other resources are resolved. In many contexts, baseURI can be determined by the document's own URL, a base element, or an xml:base attribute, and is exposed by the document object model as a property that can be read for a given node.

In HTML, the base element in the head can set the document’s base URL with its href

In XML, the xml:base attribute can be applied to elements to specify a base URI for resolving

Practical notes include the impact on resource loading and link resolution. Changing the base URI can alter

attribute.
When
present,
relative
URLs
in
the
document—such
as
those
in
anchor
hrefs,
image
src
attributes,
and
form
actions—are
resolved
against
this
base
URL.
If
no
base
element
is
provided,
the
document’s
own
URL
serves
as
the
base.
It
is
customary
to
include
only
one
base
element
with
a
defined
href;
browsers
typically
use
the
first
such
base
and
ignore
later
ones.
relative
URIs
within
that
element’s
scope.
The
effective
base
URI
is
determined
by
the
nearest
ancestor’s
base,
allowing
different
parts
of
a
document
to
use
different
bases
when
necessary.
The
DOM’s
Node.baseURI
property
reflects
this
resolution,
offering
a
programmatic
way
to
obtain
the
absolute
base.
how
relative
links
are
interpreted,
which
is
useful
in
templating
and
multi-resource
documents
but
can
lead
to
broken
links
if
not
managed
consistently.
Absolute
URLs
in
attributes
override
the
base
URI,
as
they
do
not
rely
on
relative
resolution.