W3C Validator: Flash Plugin konform und kompatibel einbinden

S

sevY

Hi,

hier noch eine Frage zu Flashplugin Einbindung.
Wie funktioniert das W3C konform, ohne die Browserkompatibilität einzuschränken?

PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="expires" content="14" />
<meta name="description" content="x" />
<meta name="keywords" lang="de" content="x" />
<meta name="robots" content="all" />
<meta name="revisit-after" content="14 days" />
<meta name="author" content="x" />
<meta name="publisher" content="x" />
<link rel="stylesheet" type="text/css" href="default.inc.css" />
<link rel="shortcut icon" type="image/ico" href="img/favicon.ico" />
<script language="javascript" type="text/javascript" src="function.inc.js"></script>
<title>x</title>
</head><body>
<div class="main">
    <div class="content">
        <script language="javascript" type="text/javascript">      
            if(hasRightVersion) 
                {
                var width='970';
                var height='600';
                var file='main.swf';  
                var mainContent='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
                + 'width="'+width+'" height="'+height+'"'
                + 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
                + '<param name="movie" value="'+file+'" />'
                + '<param name="play" value="true" />'
                + '<param name="loop" value="false" />'
                + '<param name="quality" value="high" />'
                + '<param name="menu" value="false" />'
                + '<embed src="'+file+'"'
                + 'width="'+width+'" height="'+height+'"'
                + 'play="true"'
                + 'loop="false"'
                + 'quality="high"'
                + 'menu="false"'
                + 'type="application/x-shockwave-flash"'
                + 'pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
                + '</embed>'
                + '</object>';
                document.write(mainContent);
                } 
            else 
                {
                var alternateContent='<a href="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_self" title="Get Macromedia Flashplayer"><img src="img/get_flash_player.gif" alt="Get Macromedia Flashplayer"></a>';
                document.write(alternateContent);
                }
            </script>
            <noscript>
                <img src="img/enable_javascript.gif" alt="Enable JavaScript" />
            </noscript>
        </div>
    </div>
</body>
</html>

W3C Validator sprach:

elow are the results of attempting to parse this document with an SGML parser.



Line 25, column 93: an attribute specification must start with a name or name token

...D27CDB6E-AE6D-11cf-96B8-444553540000"'



Check for stray quotes or incomplete attribute definitions.



?



Line 25, column 93: document type does not allow element "object" here

...D27CDB6E-AE6D-11cf-96B8-444553540000"'



The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).


One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).



?



Line 33, column 30: there is no attribute "src"

+ '<embed src="'+file+'"'



You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).


This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.


How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute.



?



Line 33, column 40: an attribute specification must start with a name or name token

+ '<embed src="'+file+'"'


?



Line 33, column 40: element "embed" undefined

+ '<embed src="'+file+'"'



You have used the element named above in your document, but the document type you are using does not define an element of that name. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Frameset" document type to get the "<frameset>" element), or by using vendor proprietary extensions such as "<spacer>" or "<marquee>" (this is usually fixed by using CSS to achieve the desired effect instead).



?



Line 47, column 186: document type does not allow element "a" here

...f" title="Get Macromedia Flashplayer"><img src="img/get_flash_player.gif" alt


?



Line 47, column 259: end tag for "img" omitted, but OMITTAG NO was specified

... alt="Get Macromedia Flashplayer"></a>';



You may have neglected to close a tag, or perhaps you meant to "self-close" a tag; that is, ending it with "/>" instead of ">".



?



Line 47, column 187: start tag was here

..." title="Get Macromedia Flashplayer"><img src="img/get_flash_player.gif" alt=
 
Wham, Bham, Thank you Mam!

Und wie sieht es mit den anderen Fehlern aus? ;)

Beste Grüße aus'm Pott inne Hauptstadt

Yves
 
Deine Scripteinbindung entspricht nicht den Vorgaben für XHTML. Siehe http://www.w3.org/TR/xhtml1/#h-4.8

Du hast aber noch ein größeres Problem damit: Dein Script funktioniert nur in HTML, aber nicht in XHTML, da document.write() bei XHTML Dokumenten nicht möglich ist. Du mußt Elemente ins DOM hinzufügen (mit den Namespacevarianten der Befehle). Siehe http://www.w3.org/MarkUp/2004/xhtml-faq.html#docwrite

Momentan funktioniert es, weil dein Dokument als HTML ausgeliefert und auch so interpretiert wird. Sobald es als xhtml ausgeliefert wird, wird es fehlschlagen.
 
Hi,

dadurch das ich nun die Flashdetection davor schalte, verzichte ich vollkommen auf Javascript.

PHP:
<?php require_once('head.inc.php'); ?>
<body>
<div class="mainflash">
    <div class="flash">
        <object type="application/x-shockwave-flash" data="root.swf?init=main.swf" width="970" height="600">
            <param name="movie" value="root.swf?init=main.swf" />
            <param name="quality" value="high" />
            <param name="menu" value="false" />
                <a href="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_self" title="Get Macromedia Flashplayer">
                    <img src="img/get_flash_player.gif" alt="Get Macromedia Flashplayer" />
                </a>
        </object>
    </div>
</div>
</body>
</html>

Was meinst du genau mit „als HTML“ ausgeliefert? Wann wird es denn als XHTML ausgeliefert?


Liebe Grüße

Yves
 
Yves schrieb:
Was meinst du genau mit „als HTML“ ausgeliefert? Wann wird es denn als XHTML ausgeliefert?

Der Vorteil von XHTML geht natürlich verloren, sofern man die
Dokumente als 'text/html' ausliefert.

Mehr dazu hier:

http://dciwam.de/faq/xhtml/wann-auf-xhtml-umsteigen


Edit: Und noch ein paar Links:

http://annevankesteren.nl/archives/2004/08/xhtml
http://www.xml.com/pub/a/2004/07/21/dive.html
http://ln.hixie.ch/?start=1091626816&count=1
http://www.hixie.ch/advocacy/xhtml
http://www.456bereastreet.com/archive/200501/the_perils_of_using_xhtml_properly/


Gruss

Retrax
 
Zuletzt bearbeitet von einem Moderator:
Ok,

dann müsste man entsprechend der Links folgendes tun:

Entweder direkt in der httpd.conf oder mittels .htaccess folgendes tun:

Code:
#XHTML+XML Mime Type setzen
AddType application/xhtml+xml;charset=utf-8 .xht
#Index ;)
index.xhtml 
DirectoryIndex index.xhtml

Ein guter Links ist übrigens dieser (SELFHTML).

Was ist eigentlich die korrekte W3C Endung? .xht oder .xhtml?

Nun… was ist aber bei der Nutzung von PHP? Dort sollte man ja den Mime-Type nicht verändern… oder? Also dann das ganze mittels mod_rewrite umschreiben?

Code:
RewriteEngine On
RewriteBase /
RewriteRule /([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*).xhtml(.*)$ /index.php?$1=$2&$3=$4&$5=$6&$7=$8 [L]


Vielen Dank, Retrax, für die Informationen :)

Das ganze sieht so aus, als dürfte ich die letzten 3 veröffentlichten Websites nochmal updaten.
 
Zuletzt bearbeitet von einem Moderator:
Zurück
Oben Unten