Document: fragmentDirective property
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{APIRef("URL Fragment Text Directives")}}
The **fragmentDirective** read-only property of the {{domxref("Document")}} interface returns the {{domxref("FragmentDirective")}} for the current document.
Value
A {{domxref("FragmentDirective")}} object.
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.
html hidden
js hidden
css hidden
js
if (document.fragmentDirective) {
log("Your browser supports text fragments.");
} else {
log("Text fragments are not supported in your browser.");
}{{EmbedLiveSample("Checking if text fragments are supported","100%","30px")}}
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
- Text fragments
- {{cssxref("::target-text")}}