SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Mar 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool XHTML Strict alternative to iframe !

    This is to continue from the post I read here: http://www.sitepoint.com/forums/show...tive-to-iframe

    Almost everyone that responded frustrated me SOO much that I joined to reply - only to find it is a closed subject. No one really helped. If you have comments such as 'just go transitional' then DONT EVEN BOTHER!
    Obviously he would have considered that! Did you not think that maybe he spent HOURS changing his code to Strict to find only one bit makes him need to go back to transitional?

    There is a REAL solution. Tested in Strict and +RDFa.

    HTML Code:
    <!--[if !IE]><!-->
    	<object data="http://www.link.com/" type="text/html" width="320" height="240"></object>
    <!--<![endif]-->
    <!--[if IE]>
    	<iframe frameborder="0" src="http://www.link.com/" width="320" height="240"></iframe>
    <![endif]-->
    Last edited by ralph.m; Mar 13, 2013 at 07:38. Reason: removed unnecessary language

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,069
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    I don't want to start any argument here, but you kind of missed the point. Your solution only validates because the validator ignores comments. So why would it complain about your use of an iframe when it is commented out?

    iframe is not permitted under Strict, which is what the original poster found out and was trying to find a solution to. The object tag was the appropriate solution/tag as that is permitted under Strict, however, at the time of the original posting IE didn't support it very well (it might not still -- I'm uncertain about that).

    Either way, the proposed solution you have, will pass a validator, but is dependent on the browser running conditional comments to inject an acceptable tag if not IE, and an unacceptable tag if it is IE and it definitely does not abide by the rules for Strict, it does abide by Transitional though.
    Be sure to congratulate Patche on earning July's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes

  3. #3
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    Like was mentioned the IFRAME does NOT appear within: http://www.w3.org/TR/xhtml1/dtds.htm...TML-1.0-Strict Hence if somebody attempted to directly write let's say: IFRAME or EMBED (or some other mythical element, i.e. KANGAROO) within a XHTML 1.0 Strict Document type it of course won't validate against the vanilla DTD because it isn't referenced anywhere there.

    If you want to both; deceive yourself and the W3C Validation service? Thus go against the philosophy of a Strict document by littering the document with Deprecated Elements. Hidden by either Script or Comment Delimiters, e.g. http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.4 you have achieved nothing but deception on both counts.

    Even if one chose the Extensibility route and wrote IFRAME into a Customised DTD, it would be of little gain since it appears in Transitional, all it achieves in nothing of benefit but to prove the web author likes using Deprecated elements, which of course is just bad practice (just to bypass the validator) and the path to the Dark side.
    Last edited by Stevie D; Mar 14, 2013 at 02:13. Reason: Personal comments removed

  4. #4
    om nom nom nom Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,272
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)
    I don't see the point in the comments. What's wrong with just using an iframe?

    Ooooh, the validator's gonna whine. So? Validator's just a tool for web devs to find their mistakes. If your iframe is deliberate because nothing else does the job, it's not a mistake, just invalid, which doesn't actually matter as far as HTML is concerned.
    It's HTML. Not C.

    As Wikipedia says: be bold. Use your iframe in the open. No jack-booted w3 storm trooper standarista thugs are going to bust into your bedroom in the night time and take you away to the Validation Camps with a black bag over your head. Or, that's what I've was promised when I joined the HTML Working Group.

  5. #5
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,788
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    IE8 and above fully support the use of the object tag for the purpose so that the iframe tag will become completely unnecessary once IE7 is dead. The only thing you can't control using object instead of iframe even in IE7 is that using the object tag means that you have no way to turn off the border around the embedded HTML content that the object is displaying.
    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="^$">

  6. #6
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,656
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    IE8 and above fully support the use of the object tag for the purpose so that the iframe tag will become completely unnecessary once IE7 is dead. The only thing you can't control using object instead of iframe even in IE7 is that using the object tag means that you have no way to turn off the border around the embedded HTML content that the object is displaying.
    I didn't know that. But if you can't turn off border that pretty much makes it unusable in most cases yeah.

    I used to care about the validator. Now, as you will eventually, I could care less. Simple is better.


Tags for this Thread

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
  •