Force Iframe links to stay on the same page within the same iframe

Hey peoples!
I am stuck with Iframe link forcing to stay on the page.

I am using a typical iframe code to embed some item listing.
I am trying to force the user to stay on my page when he clicks on the iframe, rather than open a new tab and go to the original website.

I’ve seen this done on another website with the same iframe but I couldn’t manage to dig how did they do it (the target= thing or the sandbox thing - which I couldn’t make it work).

Thanks so much in advance!!

You need to set the name of the iFrame in the iFrame code, then use this name on every link inside.

<iframe name="iframe1" src="target.html"></iframe>

<a href="link.html" target="iframe1">link</a>
1 Like

Hey @vincent thanks for the reply!

The links are within the iframe, which I don’t have access to the code.
Its basically clicking within the iframe and forcing it to stay within that frame not opening a new tab etc but opening a new page within the same iframe - the url of the page will stay the same in the browser.