Embed is not in the HTML spec 3.2 or 4.0

Discussion in 'HTML & Website Design' started by winterheat, Mar 21, 2008.

  1. #1
    :confused::confused:

    maybe i haven't asked before...

    embed is not really an official HTML 3.2 or 4.0 element...

    and it doesn't have a close tag </embed> isn't that true?

    on the other hand, <iframe> always requires a matching closing tag </iframe> or else it will be taken as things to display when iframe is not supported.

    is there a spec for the embed tag?

    :confused::confused:
     
    winterheat, Mar 21, 2008 IP
  2. LongHaul

    LongHaul Peon

    Messages:
    670
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <embed> was invented by Netscape, and was never part of actual HTML specs. Some other browsers support it but it's unreliable. You can use <object> instead. This page has a good tutorial on changing Flash HTML code so that it's cross-browser compliant and valid.

    And yes you should enclose your iframe stuff in <iframe></iframe>. More info about official iframe specs here.
     
    LongHaul, Mar 21, 2008 IP
  3. winterheat

    winterheat Peon

    Messages:
    125
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    oh thanks for your info... now by the since i used test embed objs a lot, it seems to work in IE, Firefox, Safari, Opera and Maxthon... does any browser actually not accept it?
     
    winterheat, Mar 22, 2008 IP
  4. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If you read the Satay article, you'll see the "Twice-baked method" which most people use to make sure everyone gets it-- object for IE and embed for the Mozilla versions.

    The question you want to ask yourself is, do you care about validation? Embed is not valid (though there's plans for it or something like it in I think HTML5... but who knows when that's coming), but it's been used longer and seems to work.

    Now, I've used Satay for some banners and whatnot, and after an Opera upgrade, everything worked (except for the whole IE asking to Continue Loading this Page?).

    People who use the SWFObject, or the Satay method, or whatever else, are doing it not because embed didn't work, but because it wasn't valid and for whatever reason people wanted to validate their sites.

    Remember that validation doesn't have much to do with something working (well, it does, but it doesn't). Lots of invalid things work. Lots of valid things don't work. The main problem being that browsers are lenient when errors occur, do not stop what they're doing and say, ERROR! (like they should).. instead, they try to guess what you really meant, and actually they are often quite good at it.

    So, it's a matter of either pride, or requirements. If you use embed, use object around it for IE. If you care about validation, don't use embed. I think this is your choice.
     
    Stomme poes, Mar 22, 2008 IP
  5. risoknop

    risoknop Peon

    Messages:
    914
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Use OBJECT instead of EMBED (not sufficiently supported) Bellow is an example of correctly embedded flash using OBJECT:

     
    risoknop, Mar 22, 2008 IP
  6. LongHaul

    LongHaul Peon

    Messages:
    670
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #6
    It's true, invalid things often work fine. And actually <embed> was a pretty good idea, maybe the one good thing about Microsoft's 90's browser nonsense (which is still serving to hurt the internet and hold back design, but I digress).

    But validation is a good habit to get into. Hopefully in the future browsers will all be programmed to follow specs exactly (shortly after Microsoft goes bankrupt ;) ), and it's good to have such things centralized and consistent. Using tags and other HTML that isn't supported may be fine now, but look at the problems that doing so in the past has led to - a big part of web design is accommodating the flaws and differences of various browsers. A big part of what I do, coding PSDs into HTML, isn't the actual coding, it's going around to various browsers and getting things consistent.

    Valid HTML doesn't fix all these things - but it fixes a lot of them, and makes it much easier to decode when something isn't working. At the very least, it can tell you when you ended up with an extra </div> that is screwing everything up! ;)
     
    LongHaul, Mar 22, 2008 IP
  7. risoknop

    risoknop Peon

    Messages:
    914
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Ehm... OBJECT works just fine in all browsers - check my code above ;) No need for EMBED in HTML5 - I hope they won't implement it again when we already have working valid solution...
     
    risoknop, Mar 23, 2008 IP
  8. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Object has some issues... and I don't know why they are bringing embed into the specs, I heard it from a guy at Opera. Object was the better idea but browser implementation is clunky. I still find that simple things like transparent backgrounds on Flash can make some browsers up-chuck, while others are fine and still others can't decide whether to put the Flash in front of other objects or in back... ignoring z-index completely.

    Possibly they mean to replace object with embed? But I just don't know. Anyway, I'll be collecting senior pension before HTML5 is out anyway.

    And I'd never in my life use the code above. It's got more code than needed. I'll work around IE's issues for rendering, but I'm not adding "codebase" to any of my pages just to get a Flash banner going. I use 5 lines of code and two of those lines is for the "backup" text and images for when there's no Flash player.
     
    Stomme poes, Mar 23, 2008 IP