htmlgoogle-chromebrowsermicrosoft-edge

Bookmark :~:text= specifications


A web url of the form someUrl#:~:text=abc%20def will highlight in yellow the words abc def on the page, at least in Chrome. For example: https://stackoverflow.com/#:~:text=Top%20Questions but not https://stackoverflow.com/#:~:text=Top%20Quest

Where can I find documentation on this? This does not seem to work in Edge.

When is the highlight applied in the page's life cycle? I find that sometimes text rendered much later by Ajax calls are highlighted?


Solution

  • That is a feature of chrome. see https://www.chromestatus.com/feature/4733392803332096

    Also, everything appearing in the urlpath after the #.("search") does not travel to the server, and it can only be parsed by either the browser (for special values, such as the one you discovered, or for anchors or id'ed elements), or by in-page script (e.g. you can choose to display different content for different search values).