0

I have html site - i would like to do the following

-----------------------------
Link1 website1     | 
Link2 website2     | Mysite
Link3 website3     |
-----------------------------

As you can see, on right side, content will be static - Its from my website.

On left side there is 3 links (a href) - which point to three different domain.

Now how to ensure, when I click on link1, website1 content displayed

---------------------------------
            | 
Website1    | Mysite
            |
---------------------------------

If link2 clicked, Website2 content will be displayed.

bonus question : Embedding other site like this way , cause any security threat to my site?

google gave me this :

see here

but its little different from my requirement

Atish Kumar Dipongkor
  • 10,220
  • 9
  • 49
  • 77
webminal.org
  • 44,948
  • 37
  • 94
  • 125
  • So you want an `iFrame` that changes source when one of the `href`'s is clicked? – Mattios550 Jun 02 '13 at 09:45
  • Embedding others sites is traditionally done by using ` – Erik Schierboom Jun 02 '13 at 09:46
  • @ Mattios550, Yes, that's right. iframe content changes when href is clicked. – webminal.org Jun 02 '13 at 09:54
  • @ Erik Schierboom, thanks for the link. I prefer not open a new window. I'll read about them and decide on it. – webminal.org Jun 02 '13 at 09:56

1 Answers1

5

You should first give your iframe a name, then target your links to that iframe

Example:

<iframe src="external.htm" name="iframe"></iframe>
<a href="http://stackoverflow.com" target="iframe">SO</a>

References:

Mark Amery
  • 143,130
  • 81
  • 406
  • 459
Ramtin Gh
  • 1,035
  • 2
  • 11
  • 31
  • 1
    Cute - I've never played with the `target` attribute on `a` elements much and had no idea this was possible. I was expecting that to do this you would need to change the `src` attribute (or analagous property) of the iframe. – Mark Amery Jun 02 '13 at 09:52
  • It worked. I placed, SO inside external.html file. Thanks – webminal.org Jun 02 '13 at 10:11