Development iFrame replacement?

Discussion in 'Software' started by TheMusician, 19 Sep 2009.

  1. TheMusician

    TheMusician Audio/Tech Enthusiast/Historian

    Joined:
    13 Jul 2009
    Posts:
    573
    Likes Received:
    32
    Hi,

    I'm updating my site, which currently uses iFrames extensively. I've read everywhere about how iFrames are bad and outdated. What do I do instead? I haven't seen a single proper example of a "css frame", or i'm just not getting it.

    Say I have this code:
    Code:
    <iframe src ="News.html" align="middle" width="90%" height="200px" frameborder="1"></iframe>
    What would a CSS version of this look like?

    I need to be able to have a frame with links in it, and when I click the links, it will only open them in the frame.
     
    Last edited: 19 Sep 2009
  2. eek

    eek CAMRA ***.

    Joined:
    23 Jan 2002
    Posts:
    1,600
    Likes Received:
    14
    CSS is used for styling elements. As such it doesn't really have a replacement element. What it does do is give you the flexibility to use and style things so that rather than using a table to display non-tabular data, you can instead use spans/divs and just positioning them exactly how you want.

    If you dno't want to use iframes, I guess you'd stick the contents of the iframe into a div.
    You can then either use some javascript to only update the html within that element when a link is clicked (read html file and stick contents in innerhtml attribute - stripping outany thing not in the 'body' tags), or alternatively reload the entire page and assuming it's all templated then getting the info in the div without changing the structure is simply done (probably most common method as it doesn't require js to be enabled, and the page should load quickly as bandwidth is not really an issue for most sites plus you can always cache things as needed).
     
    thehippoz likes this.
  3. BentAnat

    BentAnat Software Dev

    Joined:
    26 Jun 2008
    Posts:
    7,230
    Likes Received:
    219
    Jeah.. .without delving into templating and Server side scripting, my recommendation would be somehting like jQuery/AJAX and DIVs.

    If you're comfy with Server side tech like ASP/.NET/PHP, i'd recommend using that.
    There's a couple of Ways you can do that from there. Master pages in .NET, xTemplate or similar in PHP. Also, loads of PHP frameworks out there that help with that (try Keepr for example)
     
  4. capnPedro

    capnPedro Hacker. Maker. Engineer.

    Joined:
    11 Apr 2007
    Posts:
    4,381
    Likes Received:
    241
    Using JavaScript to create a page's contents is even worse than framesets!
     
  5. BentAnat

    BentAnat Software Dev

    Joined:
    26 Jun 2008
    Posts:
    7,230
    Likes Received:
    219
    Using javascript to hide and show (using CSS at runtime) isn't however. Hence my suggestion of jQuery.
     
  6. capnPedro

    capnPedro Hacker. Maker. Engineer.

    Joined:
    11 Apr 2007
    Posts:
    4,381
    Likes Received:
    241
    Yes, it really is. You want to turn a whole website into a single, humongous page which can't be bookmarked? And it will look ridiculous to clients not interpreting CSS (i.e. the blind).
     

Share This Page