Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Better alternative to an iframe to display tab content?

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, because 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> 
like image 649
laura Avatar asked Jan 20 '10 16:01

laura


People also ask

Is there a better way than iframe?

Use the embed Tag as an Alternative to Iframe in HTML The embed tag is similar to the object tag, and it is used for the same purpose. We can embed various external resources in our web page using the embed tag. We can embed media like PDF, image, audio, video, and web pages.

Why iframe is not recommended?

Iframes Bring Security Risks. If you create an iframe, your site becomes vulnerable to cross-site attacks. You may get a submittable malicious web form, phishing your users' personal data. A malicious user can run a plug-in.

Are iframe deprecated?

IFrames are not obsolete, but the reasons for using them are rare. Using IFrames to serve your own content creates a "wall" around accessing the content in that area. For crawlers like Google, It's not immediately clear that cotent in an iframe will be ranked as highly as if the content were simply part of the page.

Can you open a new tab from an iframe?

By adding target="_blank" to the anchor, it will open it in a new tab. By adding target="_parent" to the anchor, it will open it up in the same window like a normal link.


1 Answers

The only alternative to using IFRAMEs to load dynamic content (after the page has loaded) is using AJAX to update a container on your web page. It's pretty elegant and usually faster than loading a full page structure into an IFRAME.

  • Ajax with JQuery (use this and you will be loved on SO; the AJAX functions are great and simple)
  • Ajax with Prototype
  • Ajax with MooTools
  • Standalone Ajax with Matt Kruse's AJAX toolbox (Used to use this, using JQuery today because I needed a framework)
  • AJAX with Dojo (Said to be fast, but AJAX is not as straightforward)
like image 189
Pekka Avatar answered Oct 05 '22 16:10

Pekka