Document: fragmentDirective property

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

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

Value

Examples

Try running the following in a supporting browser's devtools, in a tab with one or more matched text fragments:

js
document.fragmentDirective;
// returns an empty FragmentDirective object, if supported
// undefined otherwise

This functionality is mainly intended for feature detection at present. In the future, the FragmentDirective object could include additional information.

Specifications

Specification
URL Fragment Text Directives
# dom-document-fragmentdirective

Browser compatibility

BCD tables only load in the browser

See also