48

Chrome will Soon Let You Share Link to Specific Word or Sentence on a Page

 5 years ago
source link: https://www.tuicool.com/articles/hit/qAruAfV
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Here is a really innovative and interesting Chrome feature that’s getting ready. I cannot explain this new feature in just one sentence, so stay with me.

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 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?

Highlight in a screenshot? Ask him to do a Ctrl + F on the page for a specific word or phrase? Well, what if they are on mobile? It is difficult to even dot he Ctrl + F thing there!

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.

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 .)

YvUR3ie.png!web

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%20Heading would 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”

Beyond Chrome

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?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK