GeezerVison is showing developer.mozilla.org — Document: fragmentDirective property - Web APIs | MDN
Document: fragmentDirective property
Baseline 2025
Newly available
Since March 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
The code below logs whether or not text fragments are supported in your browser by checking for existence of the object.
Note that the object is empty, and at present it is mainly intended for feature detection.
In the future, it might include other information.
const logElement = document.querySelector("#log");
function log(text) {
logElement.innerText = text;
}
js
if (document.fragmentDirective) {
log("Your browser supports text fragments.");
} else {
log("Text fragments are not supported in your browser.");
}