Hacker News new | ask | show | jobs
by amiga386 603 days ago
I'm not complaining. What I'm trying to highlight is, as it says on the caniuse.com page, this feature has "Limited availability across major browsers", and that is to be expected and accepted.

If you're thinking of promoting use of this non-standard feature, consider how many people it _doesn't_ work for, rather than thinking "oh and yes even Firefox (asoftendaysagoandonlythedesktopmainlinereleasenottheesrormobileversion) so I'll rush out and proseletyze this amazing feature that clearly everyone can use"

1 comments

Is there an alternative? Do users with browser that don't have support have a worse experience when these links are used? I thought no...
As an alternative, all browsers the traditional scrolling to named element using a URL fragment, e.g. https://en.wikipedia.org/wiki/URI#Syntax goes to the "Syntax" section of the page. While the reason of text fragments it to allow for similar linking where there isn't an element with an id, most pages with non-changing text tend also to have non-changing layout and element ids.

If you generate links that include and depend on #:~:text= to make sense, accept that it will confuse users whose browsers do not support it. They will be linked to the top of the document and no text will be highlighted. Consider not only linking, but also quoting what you wanted to be highlighted, e.g.

    John says <a href="https://example.com/#:~:text=I%20dislike%20this">he dislikes it</a>:
    <blockquote cite="https://example.com/">
       Down with this sort of thing. <em>I dislike this</em> and can't abide it.
    </blockquote>