June 10, 2020

Exploring ScrollToTextFragment

Buggy af for me...

Yesterday we launched quotebacks and I had a bunch of people suggesting that we integrate the scrolltotextfragment protocol to make the links point to the correct part of the page.

Great in theory!

However - in practice I’ve found the implementation super buggy.

First, what is ScrollToTextFragment?

In essence - ScrollToTextFragment allows you to deep-link to a specific part of a page, with the text highlighted. If you’re in Chrome it should work on any web-page. And Google is using this for their featured snippets (click through to the Verge article for screenshots):

Google is trying to make it easier to find the information you’re looking for on external websites by highlighting relevant sections in yellow, SearchEngineLand reports. The functionality works with Google’s Featured Snippets — the standalone boxes that appear at the top of search results that attempt to give you answers without having to visit a website beyond Google.

Nice in theory.


In practice I see very inconsistent behavior:

  • Sometimes the text is not highlighted and nothing happens
  • Sometimes the text is highlighted but no scroll happens
  • Sometimes you need to refresh the page to see anything happen

And some URLs always fail - while others work sporadically (wtf!).

Here’s some examples:

This one doesn’t work for me

This one works for me

Do they work for you?

Grab the bookmarklet from over here to play around and generate your own.

Can anyone shine light on what’s going on? Comments welcome below or on Twitter.

More blog posts:

A Lil' Website Refresh

March 20, 2024

This post was written by Tom Critchlow - blogger and independent consultant. Subscribe to join my occassional newsletter: