I'm looking for a way to link to a specific range of words, image or other arbitrary content on a web-page. One alternative is to introduce tons of anchors on the page, but I can live with a solution that requires JavaScript. Preferable also one that highlights the target content.
It would also be great to have some kind of protection (in the form of an alert warning) if the content of the page has been modified, and the link is no longer valid.
Does anyone know of a library that handles this, or have any advice on what to look at? I assume there is no W3C standard that enables an URL scheme for arbitrary direct linking without introducing anchors (name tags)?
Thanks!
7 years later and it is 2020, there is a draft now by WICG for Text Fragments, and now you can link to text on a page as if you were searching for it by adding the following to the hash
#:~:text=<Text To Link to>
Working example on Chrome Version 81.0.4044.138
:
Click on this link Should reload the page and highlight the link's text