EN
HTML - iframe as target for hyperlink
0
points
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>