OK, I would like to find a workaround for you, while also figuring out what exactly is going wrong. I'll need you to do some experimenting, or if you can give me a link to an example that shows the problem you are experiencing, especially a simplified example using jsfiddle or something similar, that would be great.
Is it possible to check whether the code does get executed, but only after your onload handler is called?
Could you try using addEventListener rather than the onload mechanism?
Can you try adding a static loading of the loader, just to make sure that use case still works?