0

HTML5 XML request on standalone player

Hi,

I want to use a HTML5 page that refers to a xml file via XMLHttpRequest on a standalone player without any network connection.

On my local pcs it works on firefox and edge, opera logs a cross origin violation.

The BrightSign seems to encouter an error as well, because the xml based content doesn't appear.

Is there any setting to allow local HttpRequest on the BrightSign?

 

6 comments

  • 0
    Avatar
    Brandon

    What web server is the code querying?

    HTML Local Files are referenced as file:// but HTTP requests would be http:// or https:// so there's a origin difference there.

    Is Enable external data ticked on the HTML5 state?

    See https://docs.brightsign.biz/display/DOC/HTML5
    and
    https://docs.brightsign.biz/display/DOC/HTML5+Development


    Friendly reminder, the forum is intended for user-to-user discussion. For troubleshooting problems and to ensure a timely answer from a BrightSign representative, please submit a support ticket.
  • 0
    Avatar
    Lukas Uebachs

    I don't use any webserver, it is completly local. I have 4 files index.html, main.js, styles.css and app.xml.

    I try to load the XML with:

    var xmlRequest    = new XMLHttpRequest();
    xmlRequest.onreadystatechange = xmlLoaded;
    xmlRequest.open("GET", "app.xml", true);
    xmlRequest.setRequestHeader( "Content-Type", "text/xml; charset=utf-8");
    xmlRequest.send();

    function xmlLoaded()
    {
        //manipulate divs based on xml content
    }

    External data is enabled.

    I'm not sure if there is another way to read xml, but I'm afraid this one doesn't work as standalone.

  • 0
    Avatar
    Romeo

    Hi Lukas,

     

    Please see below for an example which is very close to what you want to do but with a JSON file...


    var url = "file:////published_file_playlist.json";

    function fetchLocalJSON(url) {
    var xmlhttp = new XMLHttpRequest();

    xmlhttp.onreadystatechange = function() {

    if (this.readyState == 4) {
    var myArr = JSON.parse(this.responseText);
    //StartPlayback(myArr);
    }
    };
    xmlhttp.open("GET", url, true);
    xmlhttp.send();
    }


    fetchLocalJSON(url);

  • 0
    Avatar
    Lukas Uebachs

    I don't see the difference to my approach, except it is for a JSON file and uses absolute and not relatvie path.

    I uses the exact same request method and doubt (and hope) that it won't make any difference that the path is absolute and the file type is XML.

  • 0
    Avatar
    Brandon

    Have you tried it with an absolute path?


    Friendly reminder, the forum is intended for user-to-user discussion. For troubleshooting problems and to ensure a timely answer from a BrightSign representative, please submit a support ticket.
     
  • 0
    Avatar
    Lukas Uebachs

    How could that work? BrightAuthor renames alle files and put them into the pool folders on publish.

     

Please sign in to leave a comment.