- Use document.write to include JS.
- Use document.write (not in onload!) to create dynamic CSS.
Example script attached.
I know what you think about document.write, but the bottom line is that it used to work and it was a valid usage. If there is a workaround for that then I'm not aware of it.
Note that the CSS rules are dynamic and they must be visible (created and loaded) BEFORE the page is ready. This is the only way the page won't flicker upon loading.