Need help with iframe and jumping to topic

Tell us what’s happening:
I made 2 html file, let’s call them A.html and B.html.

In my A.html, it has my navigation link and iframe linking B.html.

I have used:

<a href="documentation.html#intro" class="nav-link">Introduction</a>

to jump to B.html introduction topic. This is where my id="intro" located.

What happens is, it opens up a new tab with B.html and jumped to the topic.

What I want to happen is to jump to the topic in B.html in the iframe i created in A.html.

Is this possible?

I hope my question makes sense.

Link to the challenge:

i hope I understand what you mean ( open your link in an iframe in the actual page )
that’s simple

you only need to add a name attribute to your iframe element like that

<iframe  src=""  name="iframeName"  height="200px"  width="100%"></iframe>

then in your anchor <a> element add a target attribute with a value equal to the iframe name’s value (in this case target="iframeName" ) … here is the final example for your first html file :

<iframe    src="your default src"    name="iframeName"     height="200px"    width="100%"></iframe>


<!-- here is your link that will be appear in the iframe -->

<a  href="documentation.html#intro"   target="iframeName"> open the link in the iframe </a>

i hope that will fix your problem :blush:

1 Like

@charaf_marghin : Thank you so much! It worked like a charm. Now I can finally do the same in my portfolio! :joy:

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