Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open a iframe link within the same iframe?

Tags:

html

iframe

I have to load outside server URL within iframe which has some links, when user clicks on a link it opens outside the iframe. But I want to open it within the same iframe.

How is it possible?

like image 739
Kalim Avatar asked Jul 23 '13 06:07

Kalim


People also ask

Can you have an iframe within an iframe?

After some research I found that you can't nest an iframe inside of an iframe in the same file. Instead what you need to do is add a reference to the child iframe as the src attribute for the parent iframe. What I did was create a main. html file and a youtube.

How do I load a link from one iframe to another iframe?

Give each iframe a unique name. Create another HTML page with multiple hyperlinks in it. Add the name of the second iframe in the target attribute of every hyperlink. Click the links in the first iframe, and you should see the pages opening in the second iframe.

How do I get an iframe link to open in a new tab?

By adding target="_blank" to the anchor, it will open it in a new tab. By adding target="_parent" to the anchor, it will open it up in the same window like a normal link.


1 Answers

You should specify target name of the iframe.

<iframe src="demo_iframe.htm" name="iframe_a"></iframe>
<p><a href="http://www.w3schools.com" target="iframe_a">www.google.com</a></p>
like image 103
Subir Kumar Sao Avatar answered Oct 24 '22 21:10

Subir Kumar Sao