Firefox and Internet Explorer iframe problems

Asked

Viewed 1,070 times

4

I have a problem with Firefox and Internet Explorer when using a iframe to upload files to the same page.

Chrome works perfectly, but in Firefox and Internet Explorer, when I click link the iframe opens on another page.

Does anyone have any solution or alternative?

The example of the code below can be seen in Jsfiddle or in this trial page.

<li><a href="pagina-1.htm" target="plantas" class="">pagina 1</a></li>
<li><a href="pagina-2.htm" target="plantas" class="">pagina 2</a></li>
<li><a href="pagina-3.htm" target="plantas" class="">pagina 3</a></li>  
<li><a href="pagina-4.htm" target="plantas" class="">pagina 4</a></li>
<li><a href="pagina-5.htm" target="plantas" class="">pagina 5</a></li>
<li><a href="pagina-6.htm" target="plantas" class="">pagina 6</a></li>

<iframe id="plantas" height="500"  width="887" src="pagina-1.htm"
 frameborder="0"  scrolling="no"></iframe>

1 answer

4


In its iframe is the name that should be used, not the id

Try it like this, using name="plantas":

<iframe id="plantas" name="plantas" height="500"  width="887" src="pagina-1.htm" frameborder="0"  scrolling="no"></iframe>

Example

According to the MDN documentation:

name
A name for the Embedded browsing context (or frame). This can be used as the value of the target attribute of an <a> or <form> element, or the formtarget attribute of an <input> or <button> element.

In English:

name
The name for the frame context. This can be used as the target attribute value of an element <a> or <form>, or the formtarget attribute of an element <input> or <button>.

  • 1

    I imagined that it would be something more complex, was already migrating to ajax, but as it is a short term project had to be iframe even, anyway, thanks @.

Browser other questions tagged

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