const resumatorScript = document.currentScript //Condition to check if the script tag is inside the body or head tag. if(document.body && document.body?.contains(resumatorScript)) { //Reders the HTML below the script tag mentioned inside body tag resumatorScript.insertAdjacentHTML('afterend', `
`); insertResumatorWrapper(); } else{ //Reders the HTML ath the begining of the body tag window.onload = function() { const body = document.body; body.insertAdjacentHTML('afterbegin', `
`); insertResumatorWrapper(); } } function insertResumatorWrapper(){ const resumatorWrapper = document.getElementById("resumator-wrapper"); resumatorScript.insertAdjacentHTML('afterend', ``) resumatorWrapper.insertAdjacentHTML('beforeend', '') resumatorWrapper.insertAdjacentHTML('beforeend', ``) }