Loading GUI XML from data URL works on Chrome/Edge but fails on Firefox

Using the Babylon GUI XmlLoader with a data URL works on Chrome & Edge, but fails on Firefox 97.0.1
The debug console shows:
Uncaught XmlLoader Exception : XML file is malformed or corrupted.

Here is a playground that shows it.

    public static addGUI(scene: BABYLON.Scene){
        const loader = new BABYLON.GUI.XmlLoader();
        const xml = "<root><TextBlock width='100px' height='100px' text='Hello World'/></root>";
        const dataURL = `data:text,${encodeURIComponent(xml)}`;
        const texture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("GUI", false, scene);
            loader.loadLayout(dataURL, texture, ()=>{
                console.log("Layout loaded");
                alert("XML Loaded from Data URL")
            console.error("Data URL failed to load.")

Please advise.

cc @null who built this part

answered on our thread: Reusing the GUI XML from GUI.XmlLoader.loadLayout() - #6 by kaliatech

1 Like