const Http = new XMLHttpRequest(); const url = 'https://helpdesk.evolua.com.br/api/lgpd/1'; Http.open('Get', url); Http.send(); Http.onreadystatechange = (e) => { if (Http.readyState === XMLHttpRequest.DONE && Http.status === 200) { insertHTML(Http.responseText, document.body, true); } } function insertHTML(html, dest, append = false) { if (!append) dest.innerHTML = ''; let container = document.createElement('div'); container.innerHTML = html; let scripts = container.querySelectorAll('script'); let nodes = container.childNodes; for (let i = 0; i < nodes.length; i++) dest.appendChild(nodes[i].cloneNode(true)); for (let i = 0; i < scripts.length; i++) { let script = document.createElement('script'); script.type = scripts[i].type || 'text/javascript'; if (scripts[i].hasAttribute('src')) script.src = scripts[i].src; script.innerHTML = scripts[i].innerHTML; document.head.appendChild(script); document.head.removeChild(script); } return true; }