#309452 - 25/04/2008 18:27
Help! HTML experts, please help me with object tags and alternate text
|
carpal tunnel
Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
|
Okay, I've got an HTML coding problem that is fallout from this thread but is unrelated to that discussion. Uncle google, combined with tons of trial and error, are not helping me. The expectation: Anything that's plaintext located between <object></object> tags is only supposed to get rendered on old browsers that ignore the object tag. Ideally, this is how you provide an alternative to the object itself. For example, my music page has little button objects that are made from the XPSF Button Player. If you have Flash installed, you get the Flash button and it streams the MP3 file when you press it. If you don't have flash installed (or you're on an iPhone/iTouch which can't run Flash objects), you get a hyperlink directly to the MP3 file. This seemed to work in all cases when I tried it. But just now, I've coded up something new that *seems* to break that desired behavior, only on Firefox, and I want to know what I've done wrong. Here's what I did. I'm considering replacing the XPSF Button Player with the Wimpy Player. It costs 20 bucks, but it solves my Flash-version-bugs nicely. Right now I'm just trying out its limited-to-playing-10-seconds demo, but if I can get it to work I'll pull the trigger on the full version. Anyway, when you use the Wimpy player, its example HTML code is very similar to what the XPSF player uses. You stick <object> and <param> tags in there that point to the wimpy player SWF file and your MP3, and if the browser supports it, you get the button. The HTML code between XPSF and Wimpy is different in a few significant ways, though, and I think that's the cause of my problem. When I do everything I think I'm supposed to do, I get this result, which is just fine on IE, but which renders BOTH the object and the alternative link on Firefox. I don't want it rendering both, I want it rendering one or the other. Can someone please look at the source code (right click, view page source) on each of these two pages linked below, in IE and Firefox on Windows, and let me know if you can see where I've gone wrong? Good behavior with XPSF Player codeBad behavior with Wimpy Player codeThanks in advance. PS: Things I have already tried: - Commenting out the <embed> object, even though Wimpy tells me it is needed. - Moving the position of my alternative text to various places within the object tags, for example, putting it right after <object> right before <embed> right before </object>, etc. - Removing many of the <param> statements.
|
Top
|
|
|
|
#309459 - 25/04/2008 19:14
Re: Help! HTML experts, please help me with object tags and alternate
[Re: tfabris]
|
carpal tunnel
Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
|
I'd throw it through an HTML validator first. It currently fails spectacularly.
_________________________
Bitt Faulk
|
Top
|
|
|
|
#309460 - 25/04/2008 19:28
Re: Help! HTML experts, please help me with object tags and alternate
[Re: wfaulk]
|
veteran
Registered: 21/01/2002
Posts: 1380
Loc: Erie, CO
|
Often incompatibilities with IE/Firefox or unexpected behavior is due to not declaring a DOCTYPE at the top of your page. http://www.w3schools.com/tags/tag_DOCTYPE.aspAnd get it to validate first.
|
Top
|
|
|
|
#309462 - 25/04/2008 21:10
Re: Help! HTML experts, please help me with object tags and alternate
[Re: tfabris]
|
carpal tunnel
Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
|
Ok, well I think I have it, but working with object and embed tags is always hacky and nasty. Take a look at http://www.norman.cx/tony/bad.html which I believe* gives the right behaviour with Flash installed and uninstalled for FF 2 and IE 7 at least. The hopefully working object tag ends up looking like this: <object type="application/x-shockwave-flash" data="http://www.vixyandtony.com/wimpy_button.swf?theFile=http://geekhackfilk.com/thirteen_samples/vixytony-13.mp3&playingColor=007700&grinderColor=007700&rollOverColor=007700&displayRewindButton=no" width="17" height="17">
<param name="movie" value="http://www.vixyandtony.com/wimpy_button.swf?theFile=http://geekhackfilk.com/thirteen_samples/vixytony-13.mp3&playingColor=007700&grinderColor=007700&rollOverColor=007700&displayRewindButton=no" />
<font size=1><a href="http://geekhackfilk.com/thirteen_samples/vixytony-13.mp3">(Sample)</a> </font>
</object> The two main changes are dropping embed completely and stealing CDBaby's structuring of the object tag. Removing the embed means the Flash player won't work in old browsers though (CDBaby don't use the embed tag). The "proper" way to do this would probably be to have just a single embed and single object that get manipulated by Javascript depending on the browser flavour, with the links left there when Javascript isn't present. That is kind of what the JC site does with some worryingly complex code. This is one area where standard conformance isn't going to help much, the way the whole object/embed tag situation is a mess. * I could well be wrong though, I got kind of bored installing and uninstalling Flash
Edited by andy (25/04/2008 21:16)
_________________________
Remind me to change my signature to something more interesting someday
|
Top
|
|
|
|
#309463 - 25/04/2008 21:14
Re: Help! HTML experts, please help me with object tags and alternate
[Re: andy]
|
carpal tunnel
Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
|
Although that said, the resulting html turns out to be HTML 4.01 Transitional valid largely by accident
_________________________
Remind me to change my signature to something more interesting someday
|
Top
|
|
|
|
#309465 - 25/04/2008 21:32
Re: Help! HTML experts, please help me with object tags and alternate
[Re: andy]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
|
The two main changes are dropping embed completely and stealing CDBaby's structuring of the object tag. Removing the embed means the Flash player won't work in old browsers though (CDBaby don't use the embed tag). Aha. That's fantastic, thanks! Question: In the cases where you say "the flash player won't work in old browsers", will those particular "old browsers" at least get the plaintext HTML link to the sample, then? If so, then that's the perfect solution for me. Thanks again! PS: I spent like an hour trying to get the entire page to validate, and managed to get it pretty close to validating but it was still giving me a few puzzling errors (still is), but I'm glad you guys had me do that exercise. It let me find a couple of egregious errors, like some table tags that got screwed up.
|
Top
|
|
|
|
#309469 - 25/04/2008 22:30
Re: Help! HTML experts, please help me with object tags and alternate
[Re: tfabris]
|
carpal tunnel
Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
|
Question: In the cases where you say "the flash player won't work in old browsers", will those particular "old browsers" at least get the plaintext HTML link to the sample, then?
If so, then that's the perfect solution for me.
I'm afraid I don't know the answer to that one. I don't have a browser old enough to test that with. By "old" we are talking about before IE 4, Firefox 1.0 and Netscape 4.5 (at least). I've been looking for somewhere that summaries "object tag support through the ages", but I can't find anything useful.
Edited by andy (25/04/2008 22:41)
_________________________
Remind me to change my signature to something more interesting someday
|
Top
|
|
|
|
#309474 - 26/04/2008 01:19
Re: Help! HTML experts, please help me with object tags and alternate
[Re: andy]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
|
I'm pretty sure it just ignores the "Object" tags and displays whatever is within them, so we're probably good.
|
Top
|
|
|
|
#309478 - 26/04/2008 02:11
Re: Help! HTML experts, please help me with object tags and alternate
[Re: tfabris]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
|
Holy cow. After getting the new Wimpy Player working with your help, now I notice Wimpy Player is exhibiting the same original issue as I got with the free XPSF player. It sits and spins (although it doesn't have a spinning animation).
Back to square one. Gr.
|
Top
|
|
|
|
#309494 - 26/04/2008 08:25
Re: Help! HTML experts, please help me with object tags and alternate
[Re: tfabris]
|
veteran
Registered: 21/03/2002
Posts: 1424
Loc: MA but Irish born
|
When it comes to testing this may be of use: http://www.vmware.com/vmtn/appliances/directory/browserapp.htmlIt is a virtual machine running Ubuntu 5.10 and has Firefox 1.5, Internet Explorer 5.0, 5.5 and 6.0 (running on Wine), Opera 8.54, Konqueror 3.5.2, ELink 0.10.4 and Lynx 2.8.5.
Edited by Phoenix42 (26/04/2008 08:26) Edit Reason: damn cat
|
Top
|
|
|
|
#309496 - 26/04/2008 08:29
Re: Help! HTML experts, please help me with object tags and alternate
[Re: Phoenix42]
|
carpal tunnel
Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
|
Now that is handy. However I have to ask, does it have a working Flash install for all of those browsers ?
_________________________
Remind me to change my signature to something more interesting someday
|
Top
|
|
|
|
#309497 - 26/04/2008 08:34
Re: Help! HTML experts, please help me with object tags and alternate
[Re: andy]
|
veteran
Registered: 21/03/2002
Posts: 1424
Loc: MA but Irish born
|
No idea, I've never used it, I was just aware of it's existence. Given that it is a VM you could add what is needed and if it borks just undo the snapshot and try again.
|
Top
|
|
|
|
#309498 - 26/04/2008 09:43
Re: Help! HTML experts, please help me with object tags and alternate
[Re: Phoenix42]
|
carpal tunnel
Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
|
Unless I am being daft that virtual machine doesn't contain any of the browsers you listed, apart from FF 1.5.0 and 1.07. It also doesn't have any sign of Wine. It doesn't even appear to have Lynx. Odd.
_________________________
Remind me to change my signature to something more interesting someday
|
Top
|
|
|
|
#309499 - 26/04/2008 09:47
Re: Help! HTML experts, please help me with object tags and alternate
[Re: andy]
|
carpal tunnel
Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
|
_________________________
Remind me to change my signature to something more interesting someday
|
Top
|
|
|
|
#309510 - 26/04/2008 17:25
Re: Help! HTML experts, please help me with object tags and alternate
[Re: andy]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
|
Okay, yeah, that's pretty handy. Saves me the trouble of setting it up myself. Thanks for that link.
|
Top
|
|
|
|
#309512 - 26/04/2008 17:35
Re: Help! HTML experts, please help me with object tags and alternate
[Re: tfabris]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
|
By the way, here's a follow up: The problem that started this thread was caused by my misunderstanding of the way the <object> tag works.
Here's how the tag reallly works:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ...> ... is for Internet Explorer on Windows only and will render and function only the ActiveX version of a Flash file.
<object type="application/x-shockwave-flash"...> ... this works on browsers that do not use ActiveX controls. Such as Firefox and Safari.
So if you encase something in the IE version of the object tag, whatever is inside that IE object tag is gonna get rendered on any browser that's not Win/IE. In my case, the thing that I had encased was an <embed> as well as the Alt text. It's no wonder they both got rendered.
|
Top
|
|
|
|
#309515 - 26/04/2008 17:58
Re: Help! HTML experts, please help me with object tags and alternate
[Re: tfabris]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
|
Okay, so here's what I want now.
- On IE, I want the <object classid=...> thing to work. - On other-than-IE, I want the <embed> to run because it works around the Adobe Flash bug. - On IE systems that do not have the ActiveX control installed, I want the alternate text. - On other-than-IE that does not allow <embed> (eg Lynx) I want the alternate text. - On other-than-IE that allows <embed> but that cannot run flash or does not have flash installed (eg iPhone, iPod), I want the alternate text.
In all cases, I don't want the alternate text to appear unless they are specifically missing Flash. I don't ever want a situation where the alternate text appears concurrently with the plugin.
Is that even possible?
I tried this: <object classid=...> <param name=...> <embed src=...> <noembed>Alternate text</noembed> </object>
This worked, except on the iPod, which shows neither the plugin (no flash player on iPod), nor the alternate text within the noembed. In fact, I didn't even see the alternate text on IE and I expected to see it.
Any other ideas?
|
Top
|
|
|
|
#309516 - 26/04/2008 18:15
Re: Help! HTML experts, please help me with object tags and alternate
[Re: tfabris]
|
carpal tunnel
Registered: 24/12/2001
Posts: 5528
|
This thread is painful to read if you're in flat mode...
|
Top
|
|
|
|
#309521 - 26/04/2008 20:12
Re: Help! HTML experts, please help me with object tags and alternate
[Re: tfabris]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
|
Okay, I think I see the root of my dilemma.
With the Object tag, even if the browser supports the tag, if the object can't load, you still get the non-object items between <object> and </object>.
With the <noembed> tag, you only get what's between the tags if the browser doesn't support embedding at all, which is a completely different situation than "the embedded object can't load". I really need a conditional command that supports the latter, and I don't think it exists.
|
Top
|
|
|
|
#309524 - 26/04/2008 22:36
Re: Help! HTML experts, please help me with object tags and alternate
[Re: tfabris]
|
carpal tunnel
Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
|
I investigated the various combinations that you have tried, if you really want it to work 100% then I'm afraid lots of nasty Javascript is the only option. It is no ones fault really, it is just that all this stuff developed faster than the standards did
_________________________
Remind me to change my signature to something more interesting someday
|
Top
|
|
|
|
#309525 - 26/04/2008 22:37
Re: Help! HTML experts, please help me with object tags and alternate
[Re: tfabris]
|
carpal tunnel
Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
|
Okay, so here's what I want now.
I tried this: <object classid=...> <param name=...> <embed src=...> <noembed>Alternate text</noembed> </object>
That was one of the many combinations I tried
_________________________
Remind me to change my signature to something more interesting someday
|
Top
|
|
|
|
#309527 - 27/04/2008 02:10
Re: Help! HTML experts, please help me with object tags and alternate
[Re: andy]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
|
yeah I'm working on a javascript solution that is actually quite simple. Check if the flash plugin exists and if not, unhide a bunch of divs.
|
Top
|
|
|
|
#309530 - 27/04/2008 05:26
Re: Help! HTML experts, please help me with object tags and alternate
[Re: tfabris]
|
pooh-bah
Registered: 15/01/2002
Posts: 1866
Loc: Austin
|
|
Top
|
|
|
|
#309531 - 27/04/2008 08:08
Re: Help! HTML experts, please help me with object tags and alternate
[Re: RobotCaleb]
|
carpal tunnel
Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
|
Ooh, that looks impressively thorough, wonder why that didn't turn up in our Googling.
_________________________
Remind me to change my signature to something more interesting someday
|
Top
|
|
|
|
#309540 - 27/04/2008 16:17
Re: Help! HTML experts, please help me with object tags and alternate
[Re: RobotCaleb]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
|
That solution suffers the same problem of assuming I need it to be an <object>. It assumes Adobe doesn't have any bugs in their Flash plugin. My problem is that I need to use <embed> to work around Adobe's bug, and <embed> has a completely different behavior with regard to the alternative content.
|
Top
|
|
|
|
#309541 - 27/04/2008 16:36
Re: Help! HTML experts, please help me with object tags and alternate
[Re: tfabris]
|
pooh-bah
Registered: 15/01/2002
Posts: 1866
Loc: Austin
|
I'd suggest getting your page to validate, first. You shouldn't be debugging it while it's not actually HTML.
|
Top
|
|
|
|
#309544 - 27/04/2008 17:45
Re: Help! HTML experts, please help me with object tags and alternate
[Re: RobotCaleb]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
|
That was already said. I worked my ass off on trying to get a test version of the page to validate and it still got tons of niggly little warnings that weren't even mine (they were in the supplied code) and weren't affecting anything. Stuff like OH NOES YOU DIDN'T SUPPLY AN ALT TAG OH NOES. OH NOES YOU DIDN'T ESCAPE YOUR AMPERSAND. C'mon, that stuff isn't affecting this. My problems have nothing to do with the validation. They are entirely due to the following issues: - Adobe Flash has a bug. One that is easily demonstratable. - I am trying to work around that bug. - In order to work around that bug, I need to throw out the best practices which say that I should not be using the deprecated <embed> tag, but rather should be using <object> - Everything on the web that talks about embedding flash in a page assumes that you want all the Best Practices and assumes that Flash doesn't have a bug. So pretty much all the stuff on the web that I look up doesn't work as-is and I can only use it as guidance as I roll my own solution. Right now I think I have a solution that's going to satisfy me, and I'm working on implementing it. It's a touch tricky because of the differences between the way IE and Firefox report the available plugins back to Javascript, but I think I'll be happy with it when I've got those ironed out. Then I just have to test it on that great VM that got posted and I should be good to go.
|
Top
|
|
|
|
#309546 - 27/04/2008 18:23
Re: Help! HTML experts, please help me with object tags and alternate
[Re: tfabris]
|
pooh-bah
Registered: 15/01/2002
Posts: 1866
Loc: Austin
|
I have had issues where Flash wasn't behaving properly and it was because the browser thought that it was rendering HTML that was written in a certain fashion when it was actually written in a different fashion. Validating fixed the issues.
|
Top
|
|
|
|
#309551 - 28/04/2008 00:46
Re: Help! HTML experts, please help me with object tags and alternate
[Re: RobotCaleb]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
|
Understood. I don't believe that's the issue in my case since I carefully characterized the bug with various different browsers and different versions of Flash. Also, the same behavior was exhibited on the pages at CDBaby.com which were formatted with completely different HTML than mine. I think I've managed a good work-around for now, so I'm hoping it's all good. If anyone wants to pound on the page with different browsers and such, it's at http://www.vixyandtony.com/music.html . Thanks!
|
Top
|
|
|
|
#309585 - 28/04/2008 23:09
Re: Help! HTML experts, please help me with object tags and alternate
[Re: Phoenix42]
|
carpal tunnel
Registered: 17/12/2000
Posts: 2665
Loc: Manteca, California
|
Is is supposed to play songs, one on top of the other, if you hit a second play button without stopping the previous?
edit: FF 2.0.0.14 XP/SP3
Edited by gbeer (28/04/2008 23:09)
_________________________
Glenn
|
Top
|
|
|
|
#309586 - 28/04/2008 23:33
Re: Help! HTML experts, please help me with object tags and alternate
[Re: gbeer]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
|
|
Top
|
|
|
|
|
|