'; var bodyDiv = document.querySelector('.body'); var parentDiv = bodyDiv.parentNode; parentDiv.insertBefore(div, bodyDiv); } } window.addEventListener("online", handleNetworkChange); window.addEventListener("offline", handleNetworkChange); handleNetworkChange(); }); }