Forum Moderators: open

Message Too Old, No Replies

Use Javascript to work around the failed validation!

When You need flash in netscape and ie and Want your code to VALIDATE! WC3

         

copenhagen

6:46 am on May 6, 2005 (gmt 0)



Here is the solution you have all been looking for.
I found it here at this link:

[java.sun.com...]
I had to modify a couple of things to make it validate (see the \) in the
object p and embed close tags.. also, the author didnt close the embed tag in the article (see the url) so I closed it in mine.

This validates, and the flash appears in both netscape and ie.
(this is not a fix limited to flash only, other mime types and active x
clsid's can be used)

You can check the page I did this on, as proof (there are links to the wc3 validator on the page) and the code is exactly the same as what I used on the site, minus the real file name.

<script language="Javascript" type="text/javascript">
var _app = navigator.appName;
if (_app == 'Netscape') {
document.write('<embed src="flash.swf"',
'width="436"',
'height="60"',
'type="application/x-shockwave-flash">',
'<\/noembed>');
}
else if (_app == 'Microsoft Internet Explorer') {
document.write('<object ',
'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"',
'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"',
'type="application/x-shockwave-flash"',
'width="436"',
'height="60">',
'<param name="movie" value="flash.swf">',
'<\/object>');
}
else {
document.write('<p>Sorry, unsupported browser.<\/p>');
}
</script>

[edited by: BlobFisk at 10:30 am (utc) on May 6, 2005]
[edit reason] No URLs please! See TOS [webmasterworld.com] [/edit]

Krapulator

7:31 am on May 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Also, Google for "flash satay method"

Bernard Marx

1:00 pm on May 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Step 1: Use validator on valid code
Step 2: Use document.write on the client to write invalid code

What's the point?

Why not just accept the fact that these attributes are going to be reported as 'invalid' in the validator, and lose no further sleep over the issue? The browser won't care anyway.

tedster

9:15 pm on May 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Macromedia features the Flash Satay method on their site. Since they are the creators of Flash, that's some pretty good authority about the approach.

[macromedia.com...]