The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Link to fragment - Help please
eagertoknow
post Jan 15 2024, 03:19 AM
Post #1





Group: Members
Posts: 6
Joined: 15-January 24
Member No.: 29,116



Not sure if this is the right place to ask this, but here goes:
I want to create a link to a specific text fragment of a web page that I highlight, so the user won't have to scroll through a potentially lengthy document and search for the fragment I want him to read. Instead, the page should scroll directly to the fragment.
I know there are various browser extensions like "Link to Fragment" and others that allegedly do the job, but they don't work for me (using Brave). They all rely on defining the fragment using the first and the last few words embedded in the generated link (using :~: after the hash sign).
However, someone knows a better way, and it works every time.
In one of his articles, he links to this, highlighted in the article: "the U.S. economy rose 4.24 times, the EU rose 3.90 times, and China rose 21.83 times, during that period from 1980 till 2022".
And here is the link he generated:
CODE

https://archive.is/rJfIP#selection-1183.224-1183.300

Going there will scroll the page to the fragment and highlight it.
The part up until the hash mark is just the address of the entire page he archived using archive.is.
The interesting part is what follows, starting with #selection.
It obviously identifies the start and end of the fragment.
I have never seen nor do I understand this syntax, and I have dug up all I could about fragments and linking to them.
The author seems to use direct coordinates without the need to embed text in the generated link. He didn't tell me how he does it, except "I select the fragment, move the cursor to the address bar, and copy the link from there." I don't know what browser he is using.
To put it differently: Why does the above link work, and what do the parameters mean?
Any help greatly appreciated.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic
eagertoknow   Link to fragment - Help please   Jan 15 2024, 03:19 AM
coothead   [indent]Any help greatly appreciated. [indent] I...   Jan 15 2024, 05:09 AM
Christian J   Maybe I missed something in the OP, but normally n...   Jan 15 2024, 08:17 AM
coothead   [indent]Maybe I missed something in the OP [inde...   Jan 15 2024, 08:53 AM
Christian J   If you take a casual glance at the code that I po...   Jan 15 2024, 10:34 AM
eagertoknow   [quote name='Christian J' post='146934' date='Jan...   Jan 15 2024, 01:31 PM
Christian J   Christian J, Thanks for the input. However, with ...   Jan 15 2024, 07:01 PM
pandy   That's very neat! If it could be made into...   Jan 15 2024, 09:48 PM
eagertoknow   [quote name='eagertoknow' post='146937' date='Jan...   Jan 15 2024, 11:57 PM
Christian J   Step 1: Visitor opens an arbitrary web page on th...   Jan 16 2024, 07:35 AM
pandy   I can only follow snips of the script. It seems th...   Jan 16 2024, 10:13 AM
eagertoknow   I can only follow snips of the script. It seems t...   Jan 16 2024, 11:47 AM
pandy   It isn't that that shows up in the URLs. But t...   Jan 16 2024, 03:26 PM
Christian J   I can only follow snips of the script. It seems t...   Jan 16 2024, 06:17 PM
pandy   It's there. I don't think the pixel positi...   Jan 16 2024, 08:38 PM
Christian J   It's there. Yes, looks like scrollToHash() ...   Jan 17 2024, 01:48 PM
eagertoknow   [quote name='pandy' post='146951' date='Jan 17 20...   Jan 18 2024, 11:29 AM
pandy   Yes, it's all in the script. That archive site...   Jan 18 2024, 05:51 PM
eagertoknow   Step 1: Visitor opens an arbitrary web page on t...   Jan 16 2024, 11:45 AM


Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 16th May 2024 - 08:49 PM