I load an iframe from third party source.
<iframe src="https://thirdparty.com/"></iframe>
In footer, I reference the JS script:
<script src="https://thirdparty.com/src.js"></script>
And I apply CSS styles also in footer. This is how third party says to load custom styles:
<script>thirdparty.setCss('https://example.com/site.css')</script>
To improve performance, I want to defer JS script. If I add defer
to script
<script defer src="https://thirdparty.com/src.js"></script>
I get error: Uncaught ReferenceError: thirdparty is not defined. I think this is because CSS file loads before JS file.
How do I defer load of CSS file also as adding defer to CSS script does not work?