Log in

View Full Version : Better Alternative to iFrames?



lauranoel
01-20-2010, 04:19 PM
Hi. I have a page with an iFrame to feature the contents of the clicked tab. There are 3 tabs, and 1 iFrame. The sources of the contents relating to each tab clicked are formatted and coded in other html & css files. What is another alternative to using an iFrame, cause I noticed that when the tab is clicked, it still shows the white background, similar to when a new page is loading?

Here's my code:


<div id="tabs">
<div id="overview">
<a target="tabsa" class="imagelink lookA" href="toframe.html">Overviews</a>
</div>
<div id="gallery">
<a target="tabsa" class="imagelink lookA" href="tawagpinoygallery.html">Gallery</a>
</div>
<div id="reviews">
<a target="tabsa" class="imagelink lookA" href="trframe.html">Reviews</a>
</div>
</div>

<div id="tabs-1">
<iframe src="toframe.html" name= "tabsa" width="95%" height="100%" frameborder="0">
</iframe>
</div>

Thanks in advance for the help!! :)

jscheuer1
01-20-2010, 06:46 PM
I don't know about better, different would be AJAX. It relies upon javascript though, and is more difficult to work with if you are loading various contents with different styles. Javascript on imported pages can be problematic. All pages must be on the same domain.

On the plus side there is no page loading effect in IE (flashing white like you mention), though there can be delays while the server fetches the page, just like with iframe. AJAX imported content is a little easier to fit into your layout if you want its container to adapt to the size of the imported content.

See:

http://www.dynamicdrive.com/dynamicindex17/indexb.html

Particularly:

http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/index.htm