Top
Best
New

Posted by damir 10/25/2024

Smarter Than 'Ctrl+F': Linking Directly to Web Page Content(alfy.blog)
228 points | 136 commentspage 2
ninalanyon 10/25/2024|
Looks like Firefox is lagging behind. It understands the url but there doesn't seem to be a way to create it from the UI. Chromium has "Copy link to highlight" in the right click/context menu but Firefox 131.0.3 doesn't. There is an add-on though: https://addons.mozilla.org/en-US/firefox/addon/link-to-text-...
andai 10/25/2024||
I've noticed that Google inserts this into result links sometimes, taking you to the relevant part of the page.
JodieBenitez 10/25/2024||
https://www.w3.org/TR/xptr-framework/
weinzierl 10/25/2024||
I was thinking of that as well. I wonder what the world would look like if the whole XHTML angle would have been a success. While it certainly had its flaws, there were definitely some interesting ideas.

Besides XPointer and its precise addressing I used to be very fascinated about more generic link types. I don't remember the spec (was it XLink?) but there was one where source, target and the location where the link was specified were independent. A link could also have multiple ends.

So you could create a personal document that linked a HN comment to two different sentences in a Wikipedia page for example.

cxr 10/26/2024||
<https://www.w3.org/annotation/>
srcnkcl 10/25/2024||
I always wished something to point at typos in websites... thanks for that
eequah9L 10/25/2024|
E.g. https://alfy.blog/2024/10/19/linking-directly-to-web-page-co...
ahmadalfy 10/26/2024||
Thank you for the highlight, I will fix it so that your link no longer work
westurner 10/25/2024||
Is there a specified / supported way to include other parameters in the URI fragment if the fragment part of the URI starts with :~:text=?

  https://example.com/page.html#:~:text=[prefix-,]textStart[,textEnd][,-suffix]
  https://example.com/page.html#:~:text=...
  https://example.com/page.html#:~:text=...&param2=two&:~:param3=three
w3c/web-annotation#442: "Selector JSON to IRI/URI Mapping: supporting compound fragments so that SPAs work" (2019): https://github.com/w3c/web-annotation/issues/442

WICG/scroll-to-text-fragment#4: "Integration with W3C Web Annotations" (2019): https://github.com/WICG/scroll-to-text-fragment/issues/4#iss...

rkta 10/25/2024||
> Text fragments are currently supported in all the browsers.

All meaning all the browsers listed in the linked table. These may be the major browsers, but not all of them.

vanviegen 10/25/2024||
Brave has this feature disable due to (rather minor, imho) privacy concerns.

https://github.com/WICG/scroll-to-text-fragment/issues/76

https://github.com/brave/brave-browser/issues/17994

joveian 10/25/2024||
That is an interesting issue (detect differing resource loading based on the document jump) that affects regular fragments as well, but the idea is that particularly sensitive pages would know not to have fragment targets in the page but couldn't prevent text fragments. The solution given (deterministic loading independent of jump target) seems like a good idea to work towards but meanwhile I agree it is a minor concern and pages should not avoid reasonable navigation due to this issue. Particularly since there are often other ways of getting the same information with the same type of network analysis.
rafram 10/25/2024||
By market share, that table contains all the major browsers and more.
amadeuspagel 10/25/2024||
I wonder whether it was a mistake to separate this feature from a standard selection.

I don't know how to design it separately. The default is that selections are blue and fragments are purple, but if you choose different colors for both, in line with your color scheme, how will people know which is which? I guess you can still choose different tones of blue and purple.

Why shouldn't selecting text automatically update the address?

V__ 10/25/2024|
Some sites do: The Wayback Machine changes the url if you change the selection.
dbodin11 10/25/2024||
This is the ultimate time saver feature when sharing. I built a web layer that does this, but goes further with multiple highlights, navigation, and rich inline communication with humans and AI, which is integrated with a web app to save, organize, and share with humans and AI. It’s https://www.kontxt.io
dveeden2 10/25/2024||
With a addon this is much more usable, not sure why there isn't a selection-to-text-fragment-link functionality builtin to Firefox...(same for other browsers?)

https://addons.mozilla.org/firefox/addon/text-fragment/

extraduder_ire 10/25/2024||
Support for the feature itself was only added in a very recent mainline firefox release. Like, less than one or two months ago.
olejorgenb 10/25/2024||
https://addons.mozilla.org/en-US/firefox/addon/link-to-text-... extension for creating links
RamRodification 10/25/2024||
According to the post

> If you’re using Chrome, simply highlight some text, right-click, and you’ll find the “Copy link to highlight” option in the context menu

hk1337 10/25/2024|
It’s really cool but it seems rather convoluted for the typical user. We should perhaps start making good use of the ID attribute and linking to that first before we start trying to use ~:text=
orr94 10/25/2024||
Using text fragments is particularly useful when you don't control the page you're linking to and it doesn't have a good anchor to link to.
IshKebab 10/25/2024|||
It's literally three clicks... Select text, right click, create link to selection.

I agree you should prefer IDs but they aren't always available, and often using them is very convoluted for users (how many are going to know how to use the element inspector, or even what an ID is?).

hk1337 10/25/2024||
It's not difficult for you and me, sure. Try explaining you need to add a tilde, colon, the work text, equals sign then the text you want to the end of the URL.
lolinder 10/25/2024|||
You're missing that Chrome has this built in to the context menu. My dad has been sending me links like this for years now, they just haven't worked for me until this month because I use Firefox.

I'm assuming Firefox has this context menu feature on the road map as well, though I suspect it will be a long time before Safari adds it just because Apple.

The average person doesn't even understand a URL at all—as far as they're concerned they're generated by computers for computers and are copied around with little regard for what the various components mean. This feature doesn't change that, it just gives a new way of creating a URL that does something slightly different.

aembleton 10/25/2024|||
Why can't the browser do all of that when you create a link to the selection?
hk1337 10/25/2024||
It would have to, kind of my point. Either the browser or someone would have to create some javascript widget to do it.
IshKebab 10/25/2024||
It does. Try it.
hk1337 10/26/2024||
I didn’t say it didn’t.
IshKebab 10/26/2024||
> It would have to
More comments...