<< Indietro
Messaggi di questa discussione
Mittente Testo dei messaggi
gcali

Avatar
Post fatti : 39
> Profilo
Scritto il : 25/10/2007 20:19 ( più di un mese )
Oggetto : dichiarazione doctype

Quando tento la validazione col validatore W3C mi viene segnalato questo potenziale problema:

  • Warning Conflict between Mime Type and Document Type

    The document is being served with the text/html Mime Type which is not a registered media type for the XHTML 1.1 Document Type. The recommended media type for this document is: application/xhtml+xml
    Using a wrong media type for a certain document type may confuse the validator and other user agents with respect to the nature of the document, and you may get some erroneous validation errors. How to fix this problem? One of the following techniques should help:

  • e poi mi si manda su Juicy per la soluzione. Juicy mi dice:

    In PHP, the MIME type is set through the header function. The $_SERVER array contains the server variables, allowing us to interrogate the Accept HTTP header.
    header("Vary: Accept");
    if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml")) 
        header("Content-Type: application/xhtml+xml; charset=utf-8");
    else
        header("Content-Type: text/html; charset=utf-8");
    Io, però non sono capace di trovare il file php dove fare il cambiamento. Cosa ne pensate? Conviene? e dove farlo se conviene?
     
     
    Giovanetti Fabio

    Noavatar
    Post fatti : 2
    > Profilo
    Scritto il : 03/11/2007 01:14 ( più di un mese )
    Oggetto : Re: dichiarazione doctype

    Inserendo la negoziazione del content-type in doceboCore\lib\lib.pagewriter.php sembra funzionare correttamente.

    Tra l'altro un commento del codice (attorno alla riga 350) spiega il perche' della scelta di text/html, anche se trovo preferibile anch'io la Content Negotiation.

    Messaggio modificato da : fbgvn il : 03/11/2007 01:19
     
    Giovanetti Fabio

    Noavatar
    Post fatti : 2
    > Profilo
    Scritto il : 03/11/2007 09:15 ( più di un mese )
    Oggetto : Re: dichiarazione doctype
    Ho fatto un po' di test. Modificando lib.pagewriter.php la Content Negotation funziona: con ie viene servito text/html e con firefox application/xhtml+xml
    E qui sorgono i problemi, in quanto con xml firefox è rigoroso e al minimo errore di marcatura sputa un bel "Errore interpretazione XML: non well-formed".. SIccome gli errori di marcatura non mancano, il backoffice diventa inservibile a meno di non usare IE.
    La domanda che mi pongo a questo punto è: perché usare xhtml 1.1 e non 1.0 strict che ammette text/html come content type?
    Messaggio modificato da : fbgvn il : 03/11/2007 09:15
     
    gcali

    Avatar
    Post fatti : 39
    > Profilo
    Scritto il : 06/11/2007 19:18 ( più di un mese )
    Oggetto : Re: dichiarazione doctype
    Che ne dicono i Capi Supremi?
     
    << Indietro