Would you like to be able to make A HYPERLINK TO A CERTAIN TEXT ON A PAGE?
Currently browsers can resolve a reference to a certain place on a web page (by a "fragment identifier" in a URL). To exploit this feature the page author must provide a special mark at a certain place on a page and you must know how to use the mark to refer to that place. Very often even if a page really contains such marks, you can't make hyperlinks to them until you, if you know how, inspect the page source to find them (unless they are made visible on the page with a hand/anchor/chain image etc.) - I've seen a lot of such situations (BTW, browsers could implement "auto-hints" for such marks, but they don't)...
Well, but
what if you want to refer to an arbitrary part of the page, not marked anyhow?
Here are two very simple bookmarklets allowing you to make a link to a certain text on a page (a so named "precise link"), save or share it and later - to open the link and see exactly the referred text shown and selected.
HOW TO USE:
- ONCE. If you want to resolve precise links (received from somebody) - drag and drop Resolve Precise Link to the bookmarks bar in your browser.
- ONCE. If you want to create precise links (to save for future use or to share with somebody) - drag and drop Make Precise Link to the bookmarks bar in your browser.
- EVER. Use the bookmarks as shown on the picture below (follow 1-2-3-4-5-6 actions):
Additional notes
- The text which you select before making a "precise link" should be as possible unique in the scope of the target page.
- A "precise link" is the target page's (where "Make Precise Link" bookmark was applied to) URL appended with an additional hash-parameter (#href-to-text=thetext).
- It does not affect the shown page content and behaviour anyhow.
- When you visit the target page by a "precise link" - if the browser doesn't have "Resolve Precise Link" bookmark (or you do not click the bookmark), the page will be shown exactly as if it was visited by its original URL.
- No any web service is involved. No any processing happens anywhere except in your browser. No any data is kept anywhere. There is only one case when an intermediate wed page (sianahoret.github.io/precise-link, i.e. this one) is involved - it's when you follow a link made by "Make Self-explained Precise Link" bookmarklet. The page is shown to provide the feature explanation. And, again, nothing happens somewhere else except in your browser.
- No any special process is permanently running - all happens only when you click a bookmark. After a dialog box has appeared (when you clicked any of "Make ... Precise Link" bookmark) and after the target page has been scrolled to the text referred on it (when you clicked the "Resolve Precise Link" bookmark) nothing more is executing.
- Every bookmarklet is just a few hundred bytes.
Why should a user click "Resolve Precise Link" bookmark every time after he's followed a "precise link"?
Indeed, it's annoying a bit. It would be much better, if, when you follow such a link, a precisely referred text is found by your browser automatically. And it's basically possible with a browser extension/add-on.
However I wouldn't like to develop and support extensions for all existing browser zoo. Moreover, if I do that, I should
persuade you to install the extension as well as I now persuade you to drag&drop the "Resolve Precise Link" bookmarklet... I consider this excess.
Current solution isn't perfect, but it's simple and usable in the majority of possible cases.
It's developed with the focus on: zero dependencies, zero infrastructure, as possible lighter requirements to a browser and network communications.
Alternative solutions of the problem
In the past
a few proposals and experimental solutions of the problem arose. Some of them are just wordings (proposals), others - browser-specific solutions, many stopped working for some reasons.
PreciseLink bookmarklets aim to be cross-browser regardless to it's not perfect (see issues below).
Known issues
- It doesn't work for referring a text within iframe.
- It doesn't work in Internet Explorer, because a non-standard browser feature is used.
- It doesn't work on mobile devices. It's, at least, because of no any trick is implemented to make drag&dropping bookmarklets possible. And the underliying feature (see the issue with IE) might also not work there.