3.2.0

Defect: MIME type "application/xhtml+xml"

Using Version 2.0 Beta3:

Defect: when "XHTML 1.0 Strict" pages are rendered using the MIME type "application/xhtml+xml", the grids do not display in the following browsers Firefox 1.0.7, Firefox 1.5, Opera 8.5, Safari 2.0.2

Workaround (not a solution): for those browsers, is to render those pages with the MIMI type "text/html". This workaround, however, causes us to forgo the extra validation that those browsers perform on pages rendered with "application/xhtml+xml"

Question: Are you planning to support pages rendered with the MIME type "application/xhtml+xml"?

Sample PHP code for content negotiation:

<?php
        # Use "Content Negotiation" to send browser-specific content type
        #
        # Note that because Beta2, Beta3 grid is not correctly
        # supporting 'application/xhtml+xml' so cannot be used
        #
        $bXHTML = strpos($_SERVER['HTTP_ACCEPT'], "application/xhtml+xml");
        if (false && $bXHTML)
                header('content-type: application/xhtml+xml; charset=utf-8');
        else
                header('content-type: text/html; charset=utf-8');
?>
David Parr
December 6,
David,

2.0 beta3 works in Firefox 1.5 with "XHTML 1.0 Strict" served as "application/xhtml+xml". You just have to properly wrap the script and style blocks in CDATA and use innerHTML = obj instead of document.write(obj)

Same applies to Opera 8.5 and 9.0p1 (grid does not fully work in Opera yet).

Here is the working example:

<?php
    header('content-type: application/xhtml+xml; charset=utf-8');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

    <link href="../../runtime/2.0/styles/xp/aw.css" rel="stylesheet" type="text/css" ></link>
    <script src="../../runtime/2.0/lib/aw.js"></script>

    <script type="text/javascript">
    //<![CDATA[


        var myData = [
            ["MSFT","Microsoft Corporation", "314,571.156", "32,187.000", "55000"],
            ["ORCL", "Oracle Corporation", "62,615.266", "9,519.000", "40650"],
            ["SAP", "SAP AG (ADR)", "40,986.328", "8,296.420", "28961"],
            ["CA", "Computer Associates Inter", "15,606.335", "3,164.000", "16000"],
            ["ERTS", "Electronic Arts Inc.", "14,490.895", "2,503.727", "4000"]
        ];

        var myColumns = [
            "Ticker", "Company Name", "Market Cap.", "$ Sales", "Employees"
        ];

    //]]>
    </script>


</head>
<body>

    <div id="target"></div>

    <script type="text/javascript">
    //<![CDATA[

    var obj = new AW.UI.Grid;

    obj.setCellText(myData);
    obj.setColumnCount(5);
    obj.setRowCount(10);

    document.getElementById("target").innerHTML = obj;

    //]]>
    </script>
</body>
</html>


Firefox 1.0 does not work out of the box because it does not allow innerHTML = ... - this could be solved by using, for example, DOMParser -

var e = document.getElementById("target");
var s = "<html xmlns=\"http://www.w3.org/1999/xhtml\">" + obj + "</html>";
var d = (new DOMParser).parseFromString(s, "text/xml");
e.appendChild(d.childNodes[0]);


Could not make it working in Safari yet.




Alex (ActiveWidgets)
December 6,
Thank you! Your suggestions worked here too. I should have known about wrapping my <style>, <script> tags in CDATA sections.

In addition to getting it to work on FireFox 1.5, Opera 8.5, the same code using your innerHTML() suggestion also worked on my Safari 2.0.2 (although clicking on the rows causes painting problems).

I have not yet attempted your solution for FireFox 1.0.7

Thanks again.
David Parr
December 7,

This topic is archived.

See also:


Back to support forum