FragmentDirective

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

The FragmentDirective interface is an object exposed for feature detectability, that is, whether or not a browser supports text fragments.

It is accessed via the Document.fragmentDirective property.

Instance properties

None.

Instance methods

None.

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
# fragmentdirective

Browser compatibility

BCD tables only load in the browser

See also