DOMParserBaseline · Widely available
The DOMParser API parses XML or HTML source code from a string into a DOM Document.
Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Mar 21, 2016. Widely available since Sep 21, 2018.
Browser support
DesktopChrome
1–30Not supported
31+Supportedsince Nov 12, 2013
Current: 155Edge
12+Supportedsince Jul 29, 2015
Current: 154Firefox
1–11Not supported
12+Supportedsince Apr 24, 2012
Current: 157Safari
1–9Not supported
9.1+Supportedsince Mar 21, 2016
Current: 27MobileChrome Android
18–30Not supported
31+Supportedsince Nov 14, 2013
Current: 155Firefox Android
4–10Not supported
14+Supportedsince Jun 26, 2012
Current: 157Safari iOS
1–9Not supported
9.3+Supportedsince Mar 21, 2016
Current: 27How to use
This feature is Baseline widely available — use it freely, no fallback needed.
Example
Full syntax and examples are on MDN: DOMParser.
Feature detection
JS · check before using
if ("DOMParser" in globalThis) {
// DOMParser is available
} else {
// load a polyfill or use a fallback
}Documentation (MDN)
Specification
Sub-features
Support for each part of the feature (5). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| DOMParser | 1 | 12 | 1 | 1.3 | 18 | 4 | 1 |
| DOMParser.DOMParser | 1 | 12 | 1 | 1.3 | 18 | 4 | 1 |
| DOMParser.parseFromString | 1 | 12 | 1 | 1.3 | 18 | 4 | 1 |
| DOMParser.parseFromString.html | 31 | 12 | 12 | 9.1 | 31 | 14 | 9.3 |
| DOMParser.parseFromString.xml | 1 | 12 | 1 | 1.3 | 18 | 4 | 1 |