Hi guys,
I want the page to be loading a js file in a header before the body.
In a script tag in the header I add the async attribute, in the body I don’t have it.
Some time it works and some times it doesn’t.
When it doesn’t work variable in the second js file will be undefined.
The first file contains variables in a global scope (global local variables). The second file is for functions using variables from those defined in the first file.
The reason I do this is to store some data in the memory so it wouldn’t need to load again when I change function. It’s one page website with native app-like functionality.
When user select that javascript functionality (each function is huge) the third or fourth or fifth js file will be loaded into the page and override the existing script dynamically.
There is no error with new script injection, but the initial page load is not quite what I expected.
Thanks