How to use <iframe> tag inside <a href=" ">

1324 views html
3

So, my plan is to show some image on page and if user click on that image he will be redirected to some certain page of some website inside of format of that image.

I tryed something like this:

<a href="https://www.w3schools.com/">
<iframe src="demo_iframe.htm" width="665" height="235"></iframe>
</a>

But, obvious it's not working...

answered question

1 Answer

7

Can you explain what you are trying to do?

What I understood was, if someone tries to click on that iframe you want them to redirect to some other link!

For this, you can use JS. Wrap it inside Div and make onClick for that div and in that function you can do href to new location.

posted this

Have an answer?

JD

Please login first before posting an answer.