Including a library in an XML based web app which causes an XML parsing error

125 views Asked by At

I want to include Adobe Analytics in a HbbTV application, which is a web application that runs on smart TVs over the top of digital broadcasts. The library is included with a script tag in the index.html file.

The index.html file on HbbTV apps is actually XML (i.e. Content-Type: application/vnd.hbbtv.xhtml+xml) and so invokes the XML rather than HTML parser.

The Adobe script at some point during its initialisation will attempt to set the innerHTML of an element of its own making to a string with valid HTML but which is invalid XML. For example it will assign a value like <span id="ps-script" data-ps-id=1 /> where the XML parser would be expecting <span id="ps-script" data-ps-id="1"></span>. As a result of doing this an error is thrown which prevents the execution of some code important for allowing the analytics library to continue initialising.

How can I include the Adobe library in our application and have it load properly?

1

There are 1 answers

0
user15227609 On

The newer HbbTV TVs (>= version 1.3.1 or 2.0) are all required to support text/html. "Newer" depends on manufacturer and country, for some it might be 5 years, for some it might be two years or even one year. In UK and Italy, (almost) all are likely to support text/html. In Germany it may be much more mixed. 1.0/1.5 (aka 1.1.1/1.2.1) might support text/html. You would have to try it and see. I realise this isn't the best answer (particularly if you're in Germany). Hopefully someone who know more about XHTML than I do may be able to help you find a proper technical way of doing this that works on all TVs without the risk / cost involved in "try it and see".