How to open a iframe link within the same iframe?

by edmond_brakus , in category: HTML & CSS , 4 months ago

How to open a iframe link within the same iframe?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by ryan.murray , 4 months ago

@edmond_brakus 

To open a link within the same iframe, you can use the target attribute in the anchor tag. Here's an example:

1
2
3
<iframe name="myiframe" src="https://www.example.com"></iframe>

<a href="https://www.example.com/page2" target="myiframe">Open link in iframe</a>


In this example, the iframe has a name attribute set to "myiframe". When you click on the link, it will open the page https://www.example.com/page2 within the same iframe.