LInking to heading on another website

Hi everyone,

I’m trying to link to an H3 heading on a web page on someone else’s website, but not sure how to do it. The h3 heading on the page doesn’t have any css id or class associated with it so I’m not sure if it can be done.

Can anyone help with this?

Thanks in advance.

Let’s see if I understand… You would like to create a link on your site that takes the user to a particular page location on another web site. Is that correct?

If so, the target h3 on the other site will need an ID assigned to it to be used as the target of a fragment identifier.

Your link: https://www.anothersite.org/pagename#targetID
The other site: <h3 id="targetID"></h3>

Thanks for the reply. Unfortunately the target H3 on the other site doesn’t have an ID assigned to it so is there any way around this?

Unfortunately the answer is, No.

I noticed that the containing div that surrounds the H3 and other elements has the following class:

class=“field__item pb-5 mb-5 border-bottom border-dark”

Can I use the class instead of an ID?

Nope, it won’t work.

And for good reason, if you think about it a page could have several instances of said class. How would the browser know where to land in the page?

Since ID’s are only used once they create a specific target.

2 Likes

Ok thanks for confirming. Looks like I’ll just have to link to the page instead of the specific point.

What you want to ask is to place a link on someone else’s web?

Hi nguyenthithuong2510 welcome to the forum

No, gwnh wants to link to another site’s page, but at somewhere specific within the page.

Similar to

https://www.w3.org/TR/2014/REC-html5-20141028/dom.html

vs.

https://www.w3.org/TR/2014/REC-html5-20141028/dom.html#element-dfn-dom

except the page doesn’t have the #element-dfn-dom fragment.

Have you tried the a href=“” code for this purpose.

Wouldn’t that simply be a link that goes nowhere?

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.