Execute JavaScript output after DOMContentLoaded

Previously, JavaScript generated for the browser would only execute on
the DOMContentLoaded event. We should also check if the browser is
already ready. We can do this with the following:

    document.readyState == "complete" || document.readyState == "loaded"

Requesting review from the great @raichoo :racehorse: