Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. FragmentDirective

FragmentDirective

Baseline 2025
Newly available

Since ⁨March 2025⁩, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

TheFragmentDirective interface is an object exposed to allow code to check whether or not a browser supportstext fragments.

It is accessed via theDocument.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 thatDocument.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.

<pre></pre>
const logElement = document.querySelector("#log");function log(text) {  logElement.innerText = text;}
#log {  height: 20px;}
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

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp