I am doing some dynamic loading of external js files, like so:
const loadFile = (path) => {
let script = document.createElement("script");
script.type = "text/javascript";
script.onload = () => {
// some stuff
};
script.src = path;
document.body.appendChild(script);
}
It works as expected in everything I've tested except older iPad models (earliest is iPad 6); on these devices, onload fires before the script is even loaded, and so nothing inside the function works.
While Googling this issue, I've tried:
onload functiononload to addEventListener for the load eventAmong other solutions. Any other ideas would be greatly appreciated!