HTML DOM Element namespaceURI

Examples

Get the namespace URI of an element in a HTML document:

let uri = element.namespaceURI;
Try it Yourself »

Get the namespace URI of an element an XHTML document:

let uri = element.namespaceURI;
Try it Yourself »

Note

The default namespace URI is the same for HTML and XHTML documents.

All HTML elements inherit the namespace URI of their parents:

http://www.w3.org/1999/xhtml


Description

The namespaceURI property returns the URI of an elements namespace.

The namespaceURI property is read-only.

The namespaceURI property has no practical use in HTML.



Syntax

element.namespaceURI

Return Value

Type Description
StringThe URI of the elements's namespace.
null if the element is not in a namespace.

Browser Support

element.namespaceURI is a DOM Level 2 (2001) feature.

It is fully supported in all browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes 9-11

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.