FragmentDirective
The FragmentDirective
interface is an object exposed to allow code to check whether or not a browser supports text fragments.
It is accessed via the Document.fragmentDirective
property.
Instance properties
None.
Instance methods
None.
Examples
Checking if text fragments are supported
The code below logs whether or not text fragments are supported in your browser by checking that Document.fragmentDirective
is defined.
Note that the object is empty, and at present 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 # fragmentdirective |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
FragmentDirective |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- See implementation notes.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.