Traté de agregar la extensión por iframe como se describe aquí: . Luego agregué padding en la parte superior del cuerpo del documento ( documnent.body ) Pero en algunas páginas hay un navegador/barra de menú con position: "fixed" que este truco no funciona. En otras palabras, el iframe oculta el navegador/barra de menú que permanece en la misma ubicación ). ¿Puedo capturar este "encabezado" o navegador de posición fija y editarlo? O hay alguna otra forma de ejecutarlo.
var iframe = document.createElement('iframe'); iframe.style.background = "#c2e9fb"; iframe.style.height = "0px"; iframe.style.width = "100%"; iframe.style.position = "fixed"; iframe.style.top = "0px"; iframe.style.right = "0px"; iframe.style.zIndex = "9000000000000000000"; iframe.frameBorder = "none"; iframe.src = chrome.extension.getURL("index.html") document.body.appendChild(iframe); function toggle(url) { let isClosed = iframe.style.height === "0px" iframe.style.height = isClosed ? "300px" : "0px" document.body.style.paddingTop = isClosed ? "300px" : "0px" }