SitePoint Sponsor

User Tag List

Results 1 to 20 of 20
  1. #1
    SitePoint Addict
    Join Date
    Sep 2008
    Location
    Rudgwick, UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    IFRAME and XHTML Validation?

    Hi,

    Is there a way we can use IFRAMES, and still validate the site fully? I have 3 different "widget" IFRAMEs, and every one of them is coming up with errors (even though they show fine in IE, FF and Chrome)

    TIA

    Andy

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,331
    Mentioned
    463 Post(s)
    Tagged
    8 Thread(s)
    As noted in your other thread, a transitional doctype will allow it, but it's worth asking why iframes are no longer valid.

  3. #3
    SitePoint Addict
    Join Date
    Sep 2008
    Location
    Rudgwick, UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I'm not a fan of IFRAMEs either, but what else can I use instead? I'm not aware of anything else that will achieve what I need to do =) (just show a remote URL on the same page)

    TIA

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,331
    Mentioned
    463 Post(s)
    Tagged
    8 Thread(s)
    You can apparently use <object> instead.

    Near the bottom of this page: http://www.w3.org/TR/WD-frames-970331

    read this:

    <IFRAME src="foo.html" width=400 height=500>

    </IFRAME>

    Becomes:

    <OBJECT data="foo.html" width=400 height=500>

    </OBJECT>

    You can read more detail on that page.

  5. #5
    SitePoint Addict
    Join Date
    Sep 2008
    Location
    Rudgwick, UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah cool, thanks - will investigate into that

  6. #6
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,871
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    It is a little more complicated if you need it to work for IE6 as well as modern browsers as IE6 requires slightly different attributes for the object tag. See noiframe.htm for a couple of ways to get it to work for both modern browsers and IE6.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  7. #7
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,331
    Mentioned
    463 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by felgall View Post
    See noiframe.htm for a couple of ways to get it to work for both modern browsers and IE6.
    Hmm, that link seems to be broken.

  8. #8
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,871
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by ralph.m View Post
    Hmm, that link seems to be broken.
    Oops seem to have lost the rest of the address. What I meant to put was - http://www.felgall.com/noiframe.htm
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  9. #9
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,331
    Mentioned
    463 Post(s)
    Tagged
    8 Thread(s)
    Thanks Felgall. Nice article, bookmarked for future reference.

  10. #10
    SitePoint Addict
    Join Date
    Sep 2008
    Location
    Rudgwick, UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    Oops seem to have lost the rest of the address. What I meant to put was - http://www.felgall.com/noiframe.htm
    Thanks, will check into that

    Cheers

    Andy

  11. #11
    SitePoint Addict
    Join Date
    Sep 2008
    Location
    Rudgwick, UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    MMm, weird. I copied the example from that page - but in IE 8, it shows scroll bars:

    http://www.cancunandrivieramaya.com/new/

    Any suggestions?

    TIA

    Andy

  12. #12
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,871
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by ultranerds View Post
    MMm, weird. I copied the example from that page - but in IE 8, it shows scroll bars:

    http://www.cancunandrivieramaya.com/new/

    Any suggestions?

    TIA

    Andy
    Internet Explorer still doesn't handle objects properly - that's why some people still use iframe even though it declared to be obsolete ten years ago.

    One alternative would be to use an iframe for IE and an object for all other browsers. With the iframe hidden inside the conditional comment the page would still validate as strict.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  13. #13
    SitePoint Addict
    Join Date
    Sep 2008
    Location
    Rudgwick, UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mmm, I think I'm gonna just stick with the IFRAME then Thanks for the info though.

    Cheers

    Andy

  14. #14
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    You could always convert your website to HTML5 (ahead of the release date), iframes were re-introduced into the Doctype for the use of sandboxing content.

  15. #15
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,331
    Mentioned
    463 Post(s)
    Tagged
    8 Thread(s)
    Very interesting. Ah Alex, you're a walking Spec! I must get around to reading those properly.

    I've noticed that Ajax is often used for this sort of thing now. It's a bit over my head at this stage, and I guess it could have accessibility problems, although, if I understand rightly, there do seems to be ways around this. I was looking at Jeremy Keith's elsewhere.adactio site today, which serves pages with Ajax but still works with JS turned off. I look forward to finding out how he does that.

  16. #16
    SitePoint Addict
    Join Date
    Sep 2008
    Location
    Rudgwick, UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AlexDawson View Post
    You could always convert your website to HTML5 (ahead of the release date), iframes were re-introduced into the Doctype for the use of sandboxing content.
    Interesting (didn't even realise there was such as thing as HTML5 <G>) - think I may leave it like we have at the moment for now (no major reason for having the site HTML valid - as it all works perfeco in Chrome, IE 6 7 and 8, and Firefox ... so those are the main browsers we care about )

    Thanks though!

    Cheers

    Andy

  17. #17
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Actually, I would go with a more unique method which is much cleaner... a div element with overflow (and width + height defined explicitly) set so you get the fixed ratio box with the content scrolling, and issue the content of that div through the use of server-side includes. It's clean, it'll validate, it allows you to control the code you want shown in an external file and it has none of the injection or accessibility risks while having the same effect

  18. #18
    SitePoint Addict
    Join Date
    Sep 2008
    Location
    Rudgwick, UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Interesting idea - didn't think about doing with SSI - may look into that

    Cheers

    Andy

  19. #19
    SitePoint Enthusiast Aaroniza's Avatar
    Join Date
    Dec 2005
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    An upper case iframe tag (like so: <IFRAME>) will not validate.

    Try changing it to lower case and seeing if it works.

  20. #20
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,871
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    If you use an <object> tag for all browsers except internet explorer and use an <iframe> tag inside conditional comments for IE then it will validate as strict.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •