#1
  1. No Profile Picture
    Spontaneously Present
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jul 2005
    Posts
    1,149
    Rep Power
    0

    Forcing content into an Iframe without javascript or SRC


    basically this

    Code:
    <iframe>
    content here
    </iframe>
    the concept is for initial load without a page to occupy it src.

    so i basically just want to force a form into it and use the iframe later with the forced form.

    when i try this, i get a blank iframe. but in view source, the content is there.. just not shown in the browser.

    any tips? tricks?
    thanks
  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,127
    Rep Power
    4304
    Anything inside an <iframe> is only displayed when <iframe> elements are not supported.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  4. #3
  5. No Profile Picture
    Spontaneously Present
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jul 2005
    Posts
    1,149
    Rep Power
    0
    i think i follow you, but im not sure.

    i experimented and just used a <frame> and got the content to show up, but when i reference that frame by an achor via target the anchor opens up a new window. its not referring to the target frame. mind you this is set up without a frame set. is that legal?

    there must be a way to force content into an iframe!
  6. #4
  7. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,127
    Rep Power
    4304
    A <frame> may only be a child of a <frameset>. Hence why <frame>s and <iframe>s exist.

    You have to create another page to load into the <iframe>.

    Reasons to Avoid Frames and iFrames

    Comments on this post

    • mwild8 agrees : great link thanks! XFrames
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  8. #5
  9. No Profile Picture
    Spontaneously Present
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jul 2005
    Posts
    1,149
    Rep Power
    0
    thanks,

    its an application, so i dont really have to follow strict public site etiquette - in fact the frame is a must! i just looking to veer away from the typical three frameset layout and make things a bit more dynamic. esp on initial load.

    cheers
  10. #6
  11. No Profile Picture
    Spontaneously Present
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jul 2005
    Posts
    1,149
    Rep Power
    0
    the best solution that i could come up with is to cache what i was trying to force into the frame and just have the src page grab that cache via db or session.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    1
    Rep Power
    0

    Lol


    I don't know how recent this post is but it seems you can use srcdoc tag for this without making another html page.

  14. #8
  15. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,127
    Rep Power
    4304
    Welcome to DevShed Forums, seemlesssrcdoc.

    True. My response from March 3rd, 2008 was regarding HTML4. HTML5 does add the srcdoc attribute (not "tag").

    Support for the srcdoc attribute is limited at this point, so I do not recommend its use for the time being. However, at least in theory, the src attribute can be used as a fallback for browsers that don't support the srcdoc attribute.
    https://developer.mozilla.org/en-US/..._compatibility
    http://weblog.bocoup.com/third-party...#iframe-srcdoc
    Last edited by Kravvitz; November 21st, 2013 at 04:30 PM.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).

IMN logo majestic logo threadwatch logo seochat tools logo