Languages
[Edit]
EN

HTML - iframe as target for hyperlink

0 points
Created by:
user4838
698

In this article, we would like to show you how to set hyperlink target to be an iframe in HTML.

Quick solution:

<iframe src="about:blank" name="iframe-1" title="Example Iframe"></iframe>

<a href="url" target="iframe-1">This link opens in iframe.</a>

 

Practical example

In this example, we create a hyperlink that opens in an empty iframe using target attribute with the iframe name value.

// ONLINE-RUNNER:browser;

<!doctype html>
<html>
<body>
<a href="https://www.dirask.com" target="iframe-1">Open dirask.com in iframe below.</a>

<iframe src="about:blank"
        name="iframe-1"
        style="height:400px; width:100%;"
        title="Dirask Homepage"></iframe>
</body>
</html>

Alternative titles

  1. HTML - iframe as target for hyperlink
  2. HTML - navigate inframe with site link
  3. HTML - open link in iframe
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join