Skip to content
Thoughtful, detailed coverage of everything Apple for 36 years
and the TidBITS Content Network for Apple professionals
36 comments

Text Fragments Enable Deep Linking on Web Pages

Wouldn’t it be nice if you could link to specific bits of text on a Web page rather than forcing people following your links to scan the page for whatever piece of information you’re trying to convey? With full support from major browser manufacturers appearing late last year, the Web has finally caught up with hypertext theory from the previous century.

The Long and Winding History of Text Fragment Linking

Sometime in the 1960s, hypertext pioneer Ted Nelson envisioned deep linking to specific pieces of text as a core feature of his proposed Project Xanadu system. (My first exposure to Xanadu came in the 1987 edition of his Computer Lib/Dream Machines from 1974, when I was working on my degree in hypertextual fiction at Cornell University. You can download the book in readable formats from the Internet Archive.)

From the early 1990s until recently, the only way to link to a specific part of a Web page was through a named anchor. If the page author inserted name="subhead1" into an anchor link in their HTML, a URL like https://example.com/#subhead1 would cause browsers to scroll directly to that spot. Although we, as users, could copy those links or examine the HTML source of a document for named anchors that we could use when creating our own links, the vast majority of links point to the top of the destination page.

In 2020, to enable deep linking within pages, Google Chrome introduced the Scroll To Text Fragment (STTF) feature. It allowed URLs with a #:~:text= parameter to link directly to any visible text on a page, so a URL like https://example.com#:~:text=specific%20phrase would highlight and scroll to the text “specific phrase” on the page. The key benefit of the feature was that it didn’t require cooperation from the page author, and Google began using it to enhance the user experience within Google Search results.

Google also built the feature into the open source Chromium code. Over the next few years, that caused most Chromium browsers to adopt the feature, including Arc, Edge, Opera, Vivaldi, and others. Until very recently, Brave was a holdout because its senior privacy researcher believed that STTF introduces some privacy risks, but Brave now supports the feature in development builds. In what I consider a misguided move, Arc’s developers decided to encapsulate the long text fragment links in a custom shortlink redirected by a server at arc.net, perhaps to make the links more readable or increase privacy. Text fragment URLs may be long, but they allow users to preview the hostname of the destination and won’t break if the arc.net redirection service disappears.

Until late 2024, Mozilla and Apple chose not to support STTF due to additional privacy concerns and annoyance with Google’s use of its control over Chromium and Google Search to effectively dictate Web standards via deployment rather than consensus. Eventually, though, Mozilla and Apple bowed to market pressure, with partial support appearing in Firefox 131 in October 2024 and full support showing up in Safari 18.2 in December 2024. Firefox will now recognize text fragment links, scrolling to and highlighting them, though an add-on is necessary to create the links. Safari can both recognize and create links.

Following Text Fragment Links

As I noted, apart from the current version of Brave, all Web browsers that I’m aware of now support following text fragment links. When you click one—and you likely won’t realize that you’re doing so ahead of time—the specified page will load and scroll to the appropriate location, and the text included in the link will be highlighted. (In the current version of Brave, the page loads but doesn’t scroll or highlight any text—the link behaves like a regular link.)

Precisely what the highlight looks like can vary because page authors can style the highlighted text using the ::target-text pseudo-element. It allows changing the color, background-color, text-decoration, text-shadow, stroke-color, fill-color, and stroke-width. However, most of the time, you’ll just see the styling used for the mark HTML element: a purple (Chromium browsers), yellow (Safari), or orange (Firefox) highlight behind the text.

Highlighted text fragment in Safari

If the linked text changes, the highlighting will fail, but the page will still load.

Creating Text Fragment Links

Making your own text fragment links is simple—the hardest part is identifying the correct command in a contextual menu—you won’t find the relevant commands in the Edit menu. First, you select the desired text, then you Control-click and:

  • In Safari, choose Copy Link with Highlight. This command is also available in Safari on the iPhone and iPad, as well as other browsers that use WebKit on these devices.
    Create a text fragment link in Safari
  • In Chromium browsers other than Brave, choose Copy Link to Highlight.
  • In Brave, after you have installed Google’s Link to Text Fragment extension, choose Copy Link to Selected Text.
  • In Firefox or Orion, after you have installed Thomas Steiner’s Link to Text Fragment extension, choose Copy Link to Selected Text. (Firefox also has a hidden configuration tweak to enable native text fragment link creation.)

What if the word you select appears multiple times within the document? How will the browser know which one to highlight? The STTF spec includes prefix and suffix components in the URL—in essence, a few words on either side of the selected text that disambiguate it. In the article in the screenshot above, linking to the word “sidebar” automatically produces this URL, which includes three disambiguation words on either side of the target word:

https://tidbits.com/2025/04/10/new-organizational-features-in-photos-in-macos-15-sequoia/#:~:text=The%20next%20two-,sidebar,-sections%20in%20Photos

It’s not inconceivable that an ambiguous link could still be created, but the worst that would happen is that the browser would highlight the wrong text on the page. You’d have to work pretty hard to make that happen—linking to more than a few words should provide uniqueness.

One final tip. You can highlight multiple portions of a document by editing the text fragment URL and appending additional text= elements, separated by an &. It requires precise work to copy the text= element from one URL and paste it into another, but the result may be worthwhile. Try it with this link below.

https://tidbits.com/2025/04/18/staying-the-course-after-35-years-of-tidbits/#:~:text=I%20believe%20we%20can%20best%20contribute%20by%20modeling%20the%20behavior%20we%20want%20to%20see%20in%20the%20world.&text=It%20means%20practicing%20kindness%2C%20decency%2C%20and%20respect%20whenever%20possible.

Can You Link Inside a PDF?

As welcome as text fragment links are, they aren’t necessary in most Web pages, which tend to be relatively short. However, PDFs are a different story. In “Add Protection from Scammers with Cyber Insurance” (11 April 2025), Glenn Fleishman linked to a Federal Trade Commission report to support his statement that Americans lost $12 billion to fraud in 2024. However, that’s a 92-page PDF, and it took me quite a few minutes to confirm the number during my edit pass.

In an ideal world, Glenn would have been able to use text fragment links to highlight the exact text he was referencing. Unfortunately, text fragment linking does not work in PDFs.

Happily, some research revealed that it is possible to link directly to the sixth page in a document, for instance, by appending #page=6 to its URL. I have updated the link in Glenn’s article to the URL below, which now scrolls to the page containing the data. It doesn’t highlight anything, but ending up on the page is far better than having to search or scroll through a lengthy PDF.

https://www.ftc.gov/system/files/ftc_gov/pdf/csn-annual-data-book-2024.pdf#page=6

Give Deep Linking a Try

Text fragment links represent a small but notable step forward in the evolution of the Web, finally realizing a part of Ted Nelson’s vision for hypertext and enabling precise navigation to specific content. Deep linking makes sharing information more efficient, improves the usability of lengthy documents, and helps readers focus on the most relevant content. I encourage you to start using text fragment links when you share information from the Web—people might not realize why the experience is better, but they’ll appreciate not having to hunt for the information you’re referencing.

Subscribe today so you don’t miss any TidBITS articles!

Every week you’ll get tech tips, in-depth reviews, and insightful news analysis for discerning Apple users. For over 36 years, we’ve published professional, member-supported tech journalism that makes you smarter.

Registration confirmation will be emailed to you.

This site is protected by reCAPTCHA. The Google Privacy Policy and Terms of Service apply.

Comments About Text Fragments Enable Deep Linking on Web Pages

Notable Replies

  1. Okay, that’s just spectacular. So useful – I’m already thinking about the varying ways to use it.

    (What’s the opposite of “enshittification”?)

  2. Oddly, while this link shows up correctly in the browser, in the email version of this article, Apple Mail (14.0, running on Big Sur) stops recognizing it as a link at the encoded space (“%20”) between “the” and “world” at the end of the first fragment, at 194 characters. Any ideas what causes this?

  3. Extremely useful! I had no idea that was what was going in Safari. Thank you!

  4. It used to just be called “software development” but it does seem we need another word now for software updates that improve the software.

    Seems it’s not just me who assumes that by default software updates these days are probably going to take something useful away rather than add it.

  5. Another great article that will be the tipping point for getting me to actually use something I’ve been dimly aware of. Thanks as always.

  6. Wow! I will be using this going forward. Thanks.

  7. I’m still using iOS 17 latest, and shared one of these just yesterday, via: Safari > (select text) > Share sheet > Messages > (type recipient name) > Send

    It looked like this in Messages, pretty good, though the why/what/how bullet points are no longer visible making it slightly more difficult to read/parse:

  8. Excellent tip @ace !
    I’m using Orion Version 0.99.130.2-beta (WebKit 621.1.2.111.4) mostly and when clicking on the “click one” link in ‘Following Text Fragment LInks’, I arrived at the linked page at the top. No text on the page was highlighted and the browser tab became stuck. Won’t go forward or backward or repond to any links on the page.
    I thought Orion was derived from Safari (I’m way out of date on how browsers work these days) so am a bit surprised it didn’t work.
    Ah well, fyi. Good to know about this though, I’ll keep trying to notice and use these links!

  9. Cool! But the “Copy Link with Highlight” command isn’t shown when I select text and option/click it in OS 14.7.1, Safari 18.1, just “Copy.”

    Probably missing something . . .

  10. For macOS you’ll need newer system.

  11. Orion is from Kagi and is focusing on privacy, so perhaps it’s taking the same tack as Brave and refusing to support the feature. Hmm… It seems that it does follow text fragment links and highlight the text appropriately, but doesn’t support creating them natively. I’ll bet one of the extensions will enable that… the Firefox extension does, the Chrome extension does not.

    It may also just be that Orion is still a beta.

  12. I’d written a long post this morning on treatment choices in CLL after venetoclax, and I’ve been able to go back and change the links in it to take readers to specific tables in quoted papers. Thanks!

    With respect to Orion, I tried my edited text specific link in Orion and it took me to the correct part of the linked page.

  13. So that’s what Copy Link with Highlight does.

    When I started reading this article the first thing I thought of was Ted Nelson’s Project Xanadu, and then there it was in the article. :slight_smile:

    But, while it is has been a long time since I read about Xanadu (perhaps in BYTE magazine?), I seem to remember one of his goals was link permamence. A link to some piece of content should always work, regardless of changes in site organization or hosting or whatever.

    But here we have the opposite of that. If the site owner changes the text even a little bit then the text fragment links break. There’d be no way for the site owner to prevent this because they don’t even know these links are being created.

  14. Well, the links degrade, in that they won’t highlight the desired text, but they don’t break, in that they’ll still load the page.

  15. Firefox does natively support creating text fragment links with a hidden configuration tweak.
    First, type about:config in the address bar, followed by the enter key and continue at the warning prompt. Then search for fragments and tweak the following settings:

    1. Set dom.text_fragments.create_text_fragment.enabled to true by double clicking on it.
    2. The following of text fragment links can be enabled (as is default?) by setting
      dom.text_fragments.enabled to true by double-clicking on it.
    3. There is also a related timeout value, the function of which seems undocumented: dom.text_fragments.create_text_fragment.timeout_seconds (default value 5).
  16. Brave has surrendered! Hooray! In fact, their writeup on Github mentions that Firefox finally agreed, and that Brave was standing alone in its refusal. They’ve acknowledged that the privacy concerns they had (which were far above my understanding) have been partially addressed, and their remaining reservations of imagined exploits would be more easily accomplished by other means. (BTW, I do not object to imagining exploits; that’s key to security going forward, and developers should always try to imagine how their systems can be misused.)

    Their version 1.78.84 (which is a beta release as of this post) now supports text fragments for deep linking on web pages. Someone going by MadhaviSeelam has tested it and it works. So it’s coming soon to the release version.

  17. It wasn’t working for me in Safari 18.4, but then I realized that StopTheMadness Pro has a “stop scroll to text fragment” rule. I had to turn that off.

  18. @ace, MacRumors apparently read your advice. :+1:
    But credit it, they don’t. :frowning:

    From today (posted less than an hour ago):

  19. Yeah, I happened to see that too—I was a little miffed, but it might have been awkward for them. It’s common for an article in one publication to trigger an article in another, but that can go in one of three ways:

    1. Very short piece linking to the original
    2. Completely new article on the same topic, often with a different take
    3. New article that covers exactly the same ground as the original

    With #1, credit and linking are the entire point.

    With #2, there’s no need for credit or a link, though it’s not a problem if they are added.

    With #3, providing a link would make it clear the extent to which the piece is derivative.

  20. Thanks for posting.

    I changed those two settings to true yesterday. Today, the first one is false, the second one is true (but not showing as changed from default), I cannot change either one (or apparently any setting in about:config), and contextual menus (either control-click or right-click) are not working.

  21. Follow up: I just highlighted some random text in this Topic and control-clicked and Orion has the option to “Copy Link to Selection”, I pasted the copied link in a new browser tab and sure enough in the new tab was the page with the selected text highlighted and the syntax in the URL field.
    Oddly enough with text highlited I didn’t find a Menu Command to copy a link to the selection. Ah well. Good feature and thanks again for reporting on it!

  22. Deep linking to PDFs and web is lovely. But what if you download the PDF to your computer, as most academics and other knowledge workers need to do, in order to use a powerful PDF reader like Skim, be able to search their files locally, use powerful utilities, etc… Well Hookmark has had its users covered for years.

    Hookmark’s deep linking works with PDF apps that have the required automation, and for which we have added deep-linking integration. Currently this includes:

    You can read about it on our website: Copying Deep PDF Links and Quotes – Hookmark. Full disclosure, I’m a co-founder of CogSci Apps Corp. which makes Hookmark. Our objective is to help you immediately retrieve the most contextually relevant information, without needing to search or navigate.

    With Hookmark you can even “hook”, = bidirectionally link, the PDF to the web page from which you downloaded it (which it will soon be able to do automatically where relevant meta-data exists in the PDF).
    Voilà!

  23. I remember Ted Nelson’s presentation at MacHack in Ann Arbor (in 1988?). Really cool ideas demoed on a MicroVAX II. His concepts of deep linking combined with micropayments would have given us a different kind of Internet.

  24. “Enhancement”.

  25. I thought your degree was in Ancient Greek? Maybe that was someone else?

  26. I have a double major from Cornell in Hypertextual Fiction (as part of the College Scholar program) and Classics (because I was interested). I was only one class away from getting a Philosophy major, too, but once I discovered there was no benefit to a triple major (trade it in for a master’s?), I didn’t sign up for that last philosophy class in my senior year.

  27. I did Philosophy single honours at Birmingham in UK, 1982. Ancient Greek would have been useful! I appreciate it for an understanding of English etymology. And as I read the neuroscientist/philosopher Iain McGilchrist’s profound books; The Master and his Emissary and more recently The Matter with Things.

  28. Having a problem getting “Deep Linking” to work. When I “Copy Link with Highlight” with Safari 18.4 (macOS 15.4.1) and paste it into Safari’s URL field it works fine. However when I paste the link into TextEdit or Apple Mail and click the link there, it just takes me to the top of the linked page

    … and, no, I don’t have StopTheMadness turned on

    Appreciate any advice

  29. On my first day at university ( U of Ottawa), in 1986, I stepped into a Greek Mythology class, thinking it might help. The professor seemed so boring that I walked out – and into a Philosophy of the Western World year-long course which I chose and adored. Still wish I knew Greek mythology, however. Coincidentally, I did my phd at Birmingham, UK.

  30. When you paste into one of the other apps, are you seeing all the special text fragment stuff at the end of the URL?

    That should be all that’s sufficient. When I paste the URL into TextEdit and turn it into a link with Make Link, clicking it does the right thing. Same with Mail.

  31. :+1: Thanks so much for this… I’m now using it and STTF is supported by Obsidian’s Web viewer, core plugin, introduced in version 1.8. :grinning:

  32. Thanks for the reply Adam

    Please forgive the delay responding - Life has had higher priority todo’s on my agenda…

    The copy with highlight is kinda working:

    • When pasted into a TextEdit document, then clicking the link, it works OK

    Here’s how the URL appears in TextEdit - first simply pasting it, 2nd Paste and Match Style

    why-using-chatgpt-is-not-bad-for-the-environment

    Why Using ChatGPT Is Not Bad for the Environment - TidBITS.

    I pasted the link into two Apple Mail email messages, with a different result each time:

    • The first time the link looked like the first screenshot - single clicking the link took me to the top of the article; double-clicking went the the highlighted text

    • The second time the link in Mail looked like the screenshot below - Single- or double-clicking the link both took me to the top of the article

    And, just now, I pasted in another highlighted link from the same article and it looks like this (Live link)

    [

    Why Using ChatGPT Is Not Bad for the Environment
    tidbits.com

    ](https://tidbits.com/2025/05/14/why-using-chatgpt-is-not-bad-for-the-environment/)

    So, kinda yes, kinda no

    enJOY
    e
    f
    f

  33. It’s hard to tell what’s going on, but if you use code text (the angle bracket button in the Discourse composer), you can put in full URLs without problem.

    In general, I don’t have any idea what’s going on. The text fragment links work as expected for me everywhere I’ve tried them.

Join the discussion in the TidBITS Discourse forum

Participants

Avatar for ace Avatar for glennf Avatar for Simon Avatar for silbey Avatar for brausch Avatar for TBTdn Avatar for ferrers_young Avatar for Quantumpanda Avatar for Jeff_Swart Avatar for tidbits43 Avatar for Will_M Avatar for mschmitt Avatar for lpeting Avatar for David_L Avatar for steve17 Avatar for drmoss_ca Avatar for LucCogZest Avatar for david_blanchard Avatar for gingerbeardman Avatar for CarAnalogy Avatar for elaurian Avatar for ThomasB