Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to link to a specific paragraph on a page without anchors?

I'm trying to write a post with form fill tutorial. There are a lot of sources, but source pages doesn't provide anchors on pages.


So my question is , how to make links to concrete paragraphs of text on html pages?

Is it possible at all?

Are there any JavaScript tricks in the url to achieve that?


edit:

I need to make link to particular paragraph on external source. For example to paragraph beginning with words "The Navy traces its origins to the" on this Wikipedia's page

like image 312
2r2w Avatar asked Aug 21 '12 18:08

2r2w


People also ask

Can I hyperlink to a specific spot on a Web page?

Simply go to that answer you want to link to and Right-Click on the area near it. From the right-click menu choose the Inspect Element option. It'll show you HTML code, look for an ID tag or Value option. Once you find it, copy it on your clipboard.


2 Answers

As of 2020, there is a draft 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

like image 110
Abderrahmane TAHRI JOUTI Avatar answered Oct 18 '22 15:10

Abderrahmane TAHRI JOUTI


You can only link to named anchors or elements with ids. If the target page has neither you are out of luck.

like image 36
JJJ Avatar answered Oct 18 '22 15:10

JJJ