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);
try{
loader.loadLayout(dataURL, texture, ()=>{
console.log("Layout loaded");
alert("XML Loaded from Data URL")
});
}catch(error){
console.error("Data URL failed to load.")
}
}
Please advise.
Thanks,
Michael