Reputation: 73
I am trying to open a webpage inside of an Iframe using the target attribute inside of a link. When you click on the link it sends you to the link, but it doesn't stay in the Iframe. Instead it opens in a new tab of the browser.
I have double checked my code and checked some similar questions, however none of them have fixed my issue. My code is below:
<iframe name="iframe_one" src="target.html" style="width:400px; height:400px;" title="Iframe for link">
</iframe>
<a href="http://www.mylink.com" target="iframe_one">
Link
</a>
Is my code in any way incorrect? Or is this no longer supported in new browsers? Are the width and height attributes in any way affecting this?
Upvotes: 1
Views: 457
Reputation: 345
I tried to copy your code and checked weather it is right or wrong. And I found it absolutely correct, everything is working fine.
A link is opened in new tab if the target is _blank and a link is opened in iframe if its framename is set as target.
So there is no error in your code, there is a possibility that your browser is not supporting this feature.
try to run this code in another browser, or try updating it to the latest version. or there might be a chance that iframe feature is turned off in your browser.
Below is the process to turn on iframe on internet explorer: To enable Iframes in Internet Explorer
Click on Tools, located on the browser toolbar Select Internet Options Select the Security tab Click on "Custom Level" button Select the Enable radial located under "Launching programs and files in an IFRAME" Click OK
You can try running on this or tell me your browser name or check yourself weather iframe feature is turned on or off.
Upvotes: 1