When you share a YouTube video, you now have an option to create a link that will start the video at a specific spot. For example, if you want your friend to start playing the video at two minutes mark, you can create a link for that specific spot.
Now, imagine you are sharing a link to a web page. There is one specific sentence or paragraph that you want your friend to read. The page does not have any anchor links.
What will you do?
Enter Scroll to Text. Scroll to Text is a new Chrome feature that will let you create a link targeting a word or phrase on a page.
How to use Scroll to Text
Google Chrome does not have a menu item or keyboard shortcut to do this yet. You can, however, create a link manually.
Here is an example link that I created: https://www.chromestory.com/2019/02/chrome-scroll-to-text/#targetText=enter
Here is how it looks like on Chrome:
Here is the flag description, explaining this feature:
“Enables scrolling to text specified in URL’s fragment.” The flag is named “Enable Text Fragment Anchor”
You can see the code commit here. But wait. I have plenty more to show you! Looks like this is a small project available on GitHub and is being ported to Chrome. The GitHub page is well documented and explains this feature in great detail.
When referencing a specific section of a web page, for example as part of sharing that content via email or on social media, it is desirable to be able to link directly to the specific section. If a section is not linkable by a named anchor or element with id, it is not currently possible to share a link directly to a specific section. Users may work around this by sharing screenshots of the relevant portion of the document (preventing the recipient of the content from engaging with the actual web page that hosts the content), or by including extra instructions to scroll to a specific part of the document (e.g. “skip to the sixth paragraph”). We would like to enable users to link to the relevant section of a document directly. Linking directly to the relevant section of a document preserves attribution, and allows the user following the URL to engage directly with the original publisher.
I highly recommend reading the whole introduction on GitHub. It is a well-written document.
This feature is being added as a flag to Chrome. It might take a week or so to show up in the Canary channel. I am hoping to get you a video demo of this feature pretty soon. (Subscribe to my channel here.)
Here is How This will Work
Borrowing from the Github document:
We propose encoding a text snippet in the URL fragment, prefixed with the
targetText=string. Since text can contain characters invalid in a URL (e.g. spaces), the text must be percent encoded. For example,
#targetText=My%20Headingwould cause the first occurance of “My Heading” on the page to be selected as the indicated part of the document.
Here is an example:
www.example.com#targetText=alpha%20beta,psi%20omega Will scroll and highlight a block of text starting with “alpha beta” and ending with “psi omega”
Here is what I think. Let me know your opinion too, in comments. I would say this is not going to be a Chrome-only feature. It is most likely that this will be added to other browsers like Firefox too.
Microsoft’s new version of Edge is going to be based on Chromium, so this will be available on Edge too.
What do you think?