Fredy
Fredy

Reputation: 2063

using iframe image as a link

I'm trying to make an iframe image link to another page. I currently has this but it's not working.

<a href="index1.html">
<iframe id ="person1"  src="images/person1.svg" frameborder="0"></iframe>
</a>

Any help would be appreciated.

Upvotes: 1

Views: 8958

Answers (2)

Olena Vikariy
Olena Vikariy

Reputation: 217

You can pass your link and image as IFrame's dynamic HTML in the src:

<iframe id="person1" frameborder="0" src="data:text/html;charset=utf-8,
    <body>
        <a target='_parent' href='index1.html'>
            <img src='images/person1.svg'>
        </a>
    </body>">
</iframe>

Upvotes: 1

Leo Javier
Leo Javier

Reputation: 1403

Here is a solution: http://jsfiddle.net/leojavier/aek5nd3z/1/

The iframe will not let you click on the link, so you just play with the element's positions on the Dom... making the hyperlink cover the Iframe... :)

CSS

a{
    display:block;
    width:500px;
    height:400px;
    position:absolute;
    top:0;
    left:0;
}
div {
    position:relative;
    width:500px;
    height:400px;
}

Upvotes: 3

Related Questions