My mission is to load a script after the page is fully rendered, both css and js wise.
What I tried so far is:
- side loading with a page popstate counter,
- loading it via "defer" and "async" attribute,
- loading it via another script with "defer" attribute,
- via "onpageshow" event,
- via "DomContentLoaded-----" event,
- the "onload" event.
But all have the same result.
The part of this matter I don't understand is: the script that I try to load is of type "module" and it imports various functions from an already-loaded js file. That already-loaded js file prevents the default action on form elements to do a "submit" action.
But when I append the script I want to run after the page is fully rendered, it just reloads the entire page.
So why does the page reload if one the previous scripts already added a preventDefault on all forms for the submit action?
Any suggestions to prevent a page reload?
Thanks for any help.