Document: fragmentDirective property

The fragmentDirective read-only property of the Document interface returns the FragmentDirective for the current document.

Value

Examples

Checking if text fragments are supported

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.

js
if (document.fragmentDirective) {
  log("Your browser supports text fragments.");
} else {
  log("Text fragments are not supported in your browser.");
}

Specifications

Specification
URL Fragment Text Directives
# dom-document-fragmentdirective

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
fragmentDirective

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.

See also