Home

NotAllowedError

NotAllowedError is a type of DOMException used by web platform APIs to indicate that an operation is not allowed. It is typically raised when an action is blocked by user permission, policy, or the current context rather than by a technical fault. The error name is "NotAllowedError," and it appears in APIs such as MediaDevices.getUserMedia and Geolocation when access is denied, or when a required user gesture is not provided.

In practice, NotAllowedError often means the user has denied permission to use a resource (for example, the

Handling: Developers typically catch the DOMException and check the name property (error.name === "NotAllowedError"). The recommended response

Compatibility: NotAllowedError is widely supported in modern browsers for the relevant APIs. Some older environments may

camera
or
microphone)
or
that
the
page
is
not
allowed
to
perform
a
certain
action
under
the
current
policy,
such
as
autoplay
restrictions.
The
exact
conditions
and
messages
can
vary
by
API
and
browser,
but
the
common
theme
is
explicit
denial
or
policy
prohibition
rather
than
a
bug
in
the
code.
is
to
inform
the
user,
request
permission
again
in
response
to
a
clear
user
gesture,
or
degrade
gracefully
if
access
cannot
be
granted.
It
can
also
be
helpful
to
check
permission
status
via
the
Permissions
API
and
ensure
the
page
is
served
over
HTTPS.
report
similar
conditions
under
different
error
names.
Related
errors
include
NotReadableError,
NotSupportedError,
and
SecurityError.