How to change the "src" of an iframe without changing the user URL?

Asked

Viewed 2,313 times

3

How to exchange the contents of an iframe internally without changing the site URL?

Example: User entered my site: http://example.com and it contains an iframe:

<iframe src="http://teste455.esy.es/v3/wp-content/arcade/?url=Rockman X 3 (J).smc&amp;system=snes&amp;plataforma=snes" width="640" height="500" scrolling="no"></iframe>

In this iframe there is a link. How do I stop instead of using several iframes on a page, I can change the content of iframe, in case the link, only with a drop-down menu that when clicking the content of iframe is changed?

It would be like a playlist and would have a drop-down menu above the iframe and clicking the iframe link would be changed to another that in the case is the same as the one above.

I would like to do this in a single HTML page.

1 answer

4


In accordance with this excellent response, the iframe is simply a relative of the old frame, then it’s only a matter of defining the target in your menu item (probably a <a>):

<iframe width="500" height="500" src="about:blank" name="testframe"></iframe>

<a href="http://example.com/pagina-1" target="testframe">Um</a>
<a href="http://example.com/pagina-2" target="testframe">Dois</a>
  • So how do you make this part of the links appear in the drop-down menu?

  • @Crazy, the Stack scheme is basically like this: you do one question at a time. You didn’t ask about drop down menu, asked about iframe. . . . . . Remembering that: there is no problem in asking here until complete an entire project, but is essential that you go bumping head and ask your questions only after to test hard and find no answer.

  • I found the solution right here on the site. only as always as soon as I find a solution appears another doubt/ problem.

  • That’s right, programming is a 7-headed bug. Stack is a 1-question website ;)

  • On the day that for you programming is a 4-headed bug, you can be sure it’s good on the stuff, jejejeje

Browser other questions tagged

You are not signed in. Login or sign up in order to post.