TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Smarter Than 'Ctrl+F': Linking Directly to Web Page Content

228 pointsby damir7 months ago

27 comments

lolinder7 months ago
Today I learned that Firefox finally implemented these! They don&#x27;t mention this in the article, but that&#x27;s new this month—for the longest time Chrome supported it but it isn&#x27;t in the standard and Firefox didn&#x27;t include it. Safari got it 2 years later, but Firefox held out for a while.<p>I&#x27;m normally not a fan of Chrome unilaterally adding something to the platform, but this has been a long time coming.
评论 #41945744 未加载
gertrunde7 months ago
In all honesty, I&#x27;ve hated this feature with a passion ever since it appeared.<p>If it was simply a matter of being used in the way outlined in the article, when someone creates a a link that references a particular piece of text, then fine, someone has deliberated intended the link to behave like that.<p>And then we have the lovely folk at Google search... who think it&#x27;s fun to drag my attention off to a random part of a page that isn&#x27;t where I want to be, forcing me to right-click, remove annotation and scroll back up to the top of the page.<p>That doesn&#x27;t seem like a massive hardship, but it gets quite frustrating when multiplied over the many searches done in a day&#x2F;week&#x2F;month.
评论 #41950591 未加载
评论 #41945646 未加载
评论 #41946267 未加载
rakoo7 months ago
Unsurprisingly this is something you could do in Plan 9:<p><pre><code> &#x2F;path&#x2F;to&#x2F;file:&#x2F;from.*to </code></pre> opens the file and sets the selection to the range of text between &quot;from&quot; and &quot;to&quot;. Bonus: you can use regular expressions.<p>It pains me to see the web having strayed so far from its focus on interlinking. It&#x27;s easy to make a parallel when on one side device makers have taken control back by removing access to files and putting applications first (this is the only model on mobile), to the point that those makers have enormous control over apps&#x27; existence, and the web where applications are now the only way to access content, to the point that content may or may not available if the right API exists.
评论 #41945657 未加载
评论 #41948662 未加载
shakna7 months ago
Super unintuitive that the HTTP header a site can set, to disable this, is:<p><pre><code> Document-Policy: force-load-at-top</code></pre>
评论 #41945018 未加载
评论 #41945144 未加载
fbn797 months ago
In Google Chrome select text, right click and click &quot;copy link to highlight&quot;. It create a link with ~:text=
评论 #41944840 未加载
thinkingemote7 months ago
Programmatically what can a developer do with this?<p>I see that there is a method and an object to see if its enabled or not. And there is a way to get the whole fragment which can be parsed.<p>Are there methods to see whether some text in the fragment was actually highlighted or not? Are there methods to programmatically select text?<p>Could there be a way to, for example, draw a rectangle around the highlighted section, to get the coordinates of the text, to read out the selected text, to store what words people select and link to etc<p>Maybe it&#x27;s an external link about headline news and the news title got changed by the editor. Maybe the developer may want to change the selection to the edited title so the user isn&#x27;t surprised. Maybe its a multi lingual blog post and the user links using another language... etc etc
评论 #41945262 未加载
pbiggar7 months ago
I use these for footnotes, eg in [1] which had a lot of footnotes. Ghost and other blogs don&#x27;t support footnoting well afaict. Sometimes I miss restructured text, which did this quite well, markdown alas does not.<p>[1] <a href="https:&#x2F;&#x2F;blog.paulbiggar.com&#x2F;i-cant-sleep&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.paulbiggar.com&#x2F;i-cant-sleep&#x2F;</a>
donohoe7 months ago
I built something like this for <i>The New York Times</i> and it was one of the more fun projects I did there.<p>The thing I really hoped this &quot;new&quot; version would account for is when text changes and having links survive minor edits&#x2F;changes. Perhaps I missed it and it does.<p>- <a href="https:&#x2F;&#x2F;github.com&#x2F;NYTimes&#x2F;Emphasis">https:&#x2F;&#x2F;github.com&#x2F;NYTimes&#x2F;Emphasis</a><p>- <a href="https:&#x2F;&#x2F;open.nytimes.com&#x2F;emphasis-update-and-source-6ffac5e69fd8" rel="nofollow">https:&#x2F;&#x2F;open.nytimes.com&#x2F;emphasis-update-and-source-6ffac5e6...</a> (2011)
评论 #41956474 未加载
评论 #41954220 未加载
jiri7 months ago
It would be nice to have similar feature like this, but to highlight rectangle (instead of text) on the page to focus viewer on some specific area. I send screenshots with highlight quite often.
评论 #41944889 未加载
评论 #41944590 未加载
al_borland7 months ago
Every time I run across this I think about how useful it is, then forget it exists and never actually use it.
ninalanyon7 months ago
Looks like Firefox is lagging behind. It understands the url but there doesn&#x27;t seem to be a way to create it from the UI. Chromium has &quot;Copy link to highlight&quot; in the right click&#x2F;context menu but Firefox 131.0.3 doesn&#x27;t. There is an add-on though: <a href="https:&#x2F;&#x2F;addons.mozilla.org&#x2F;en-US&#x2F;firefox&#x2F;addon&#x2F;link-to-text-fragment&#x2F;" rel="nofollow">https:&#x2F;&#x2F;addons.mozilla.org&#x2F;en-US&#x2F;firefox&#x2F;addon&#x2F;link-to-text-...</a>
andai7 months ago
I&#x27;ve noticed that Google inserts this into result links sometimes, taking you to the relevant part of the page.
JodieBenitez7 months ago
<a href="https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;xptr-framework&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;xptr-framework&#x2F;</a>
评论 #41945291 未加载
评论 #41956496 未加载
srcnkcl7 months ago
I always wished something to point at typos in websites... thanks for that
评论 #41944247 未加载
westurner7 months ago
Is there a specified &#x2F; supported way to include other parameters in the URI fragment if the fragment part of the URI starts with :~:text=?<p><pre><code> https:&#x2F;&#x2F;example.com&#x2F;page.html#:~:text=[prefix-,]textStart[,textEnd][,-suffix] https:&#x2F;&#x2F;example.com&#x2F;page.html#:~:text=... https:&#x2F;&#x2F;example.com&#x2F;page.html#:~:text=...&amp;param2=two&amp;:~:param3=three </code></pre> w3c&#x2F;web-annotation#442: &quot;Selector JSON to IRI&#x2F;URI Mapping: supporting compound fragments so that SPAs work&quot; (2019): <a href="https:&#x2F;&#x2F;github.com&#x2F;w3c&#x2F;web-annotation&#x2F;issues&#x2F;442">https:&#x2F;&#x2F;github.com&#x2F;w3c&#x2F;web-annotation&#x2F;issues&#x2F;442</a><p>WICG&#x2F;scroll-to-text-fragment#4: &quot;Integration with W3C Web Annotations&quot; (2019): <a href="https:&#x2F;&#x2F;github.com&#x2F;WICG&#x2F;scroll-to-text-fragment&#x2F;issues&#x2F;4#issuecomment-464485999">https:&#x2F;&#x2F;github.com&#x2F;WICG&#x2F;scroll-to-text-fragment&#x2F;issues&#x2F;4#iss...</a>
rkta7 months ago
&gt; Text fragments are currently supported in all the browsers.<p>All meaning all the browsers listed in the linked table. These may be the major browsers, but not all of them.
评论 #41944238 未加载
评论 #41944909 未加载
amadeuspagel7 months ago
I wonder whether it was a mistake to separate this feature from a standard selection.<p>I don&#x27;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.<p>Why shouldn&#x27;t selecting text automatically update the address?
评论 #41945027 未加载
dbodin117 months ago
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 <a href="https:&#x2F;&#x2F;www.kontxt.io" rel="nofollow">https:&#x2F;&#x2F;www.kontxt.io</a>
dveeden27 months ago
With a addon this is much more usable, not sure why there isn&#x27;t a selection-to-text-fragment-link functionality builtin to Firefox...(same for other browsers?)<p><a href="https:&#x2F;&#x2F;addons.mozilla.org&#x2F;firefox&#x2F;addon&#x2F;text-fragment&#x2F;" rel="nofollow">https:&#x2F;&#x2F;addons.mozilla.org&#x2F;firefox&#x2F;addon&#x2F;text-fragment&#x2F;</a>
评论 #41944336 未加载
评论 #41944314 未加载
hk13377 months ago
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=
评论 #41944709 未加载
评论 #41945612 未加载
评论 #41944857 未加载
seinecle7 months ago
I wonder how that can be leveraged for SEO
polotics7 months ago
Very nice! Hopefully Firefox developers have the bandwidth to implement this as well, and not let Google Chrome have this feature as an &quot;embrace and extend&quot; differentiator. As for MS-Edge, well I guess it must be funny for Microsoft to see they&#x27;re getting a taste of their own sweet old medicine...
评论 #41944008 未加载
评论 #41943944 未加载
评论 #41943828 未加载
评论 #41943920 未加载
评论 #41943915 未加载
kwantaz7 months ago
Copy link to highlight is best feature.
_giorgio_7 months ago
Can you <i>disable it in firefox</i>?<p>shift+i -&gt; &quot;permissions&quot; -&gt; disable &quot;override keyboard shortcuts&quot;
评论 #41944929 未加载
dakiol7 months ago
Is it just me or whenever I open a link with a text fragment, the page is loaded just fine but it takes one or two seconds to actually scroll down to the highlighted text?<p>Usually in Chrome and when visiting sites that are not 100% pure text (e.g., bloated Confluence docs)
评论 #41954676 未加载
评论 #41945411 未加载
RedShift17 months ago
Sidenote: please don&#x27;t hijack CTRL+F on webpages, thanks. Sincerely, the world.
评论 #41944304 未加载
评论 #41943824 未加载
评论 #41944100 未加载
评论 #41944984 未加载
评论 #41944614 未加载
评论 #41943935 未加载
评论 #41944078 未加载
评论 #41944680 未加载
评论 #41945692 未加载
评论 #41945299 未加载
评论 #41945388 未加载
评论 #41945696 未加载
xp847 months ago
This also works perfectly in Microsoft Edge and has for a long time. Pointing this out because the post makes several references to things being exclusive to Chrome, when really it&#x27;s probably just Chromium.<p>(I&#x27;m still puzzled why so many more people choose to use a browser distributed by the world&#x27;s largest ad network over one with all the same features plus a few nice add-ons, made by a software company.)
评论 #41945268 未加载
评论 #41945257 未加载