Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

209
Visualizações
Cómo acelerar en red en iframe como si tuviéramos una herramienta de desarrollo

Cómo acelerar en red en iframe como lo tenemos en una herramienta de desarrollo, digamos que quiero abrir mi propio sitio web dentro de iframe, y quiero acelerar con un modo 3g lento, ¿cómo podemos lograrlo?

Si quiero hacer esto usando la extensión de Chrome, ¿hay alguna API para hacer esto?

He agregado el siguiente código para habilitar el depurador de Chrome, pero esto es para la página o pestaña, no para el iframe en particular.

 await chrome.tabs.query( { currentWindow: true, active: true }, function (tabs) { console.log("tabs--->", tabs); console.log(tabs[0].id); chrome.debugger.attach({ tabId: "8C206DBB36086B4E52EB465197CE01ED" }, "1.3", () => { if (chrome.runtime.lastError) { console.log("runtime.lastError", chrome.runtime.lastError.message); return; } console.log("Debugger attached"); }); chrome.debugger.sendCommand( { tabId: tabs[0].id }, "Network.enable", () => { if (chrome.runtime.lastError) { console.log( "runtime.lastError", chrome.runtime.lastError.message ); return; } console.log("Debugger attached"); } ); const newtworkThrottleValues = { offline: { downloadThroughput: 0, uploadThroughput: 0, latency: 0, offline: true, }, slow3G: { downloadThroughput: ((500 * 1024) / 8) * 0.8, uploadThroughput: ((500 * 1024) / 8) * 0.8, latency: 400 * 5, offline: false, }, fast3G: { downloadThroughput: ((1.6 * 1024 * 1024) / 8) * 0.9, uploadThroughput: ((750 * 1024) / 8) * 0.9, latency: 150 * 3.75, offline: false, }, online: { downloadThroughput: -1, uploadThroughput: -1, latency: 0, offline: false, }, }; chrome.debugger.getTargets((result) => { console.log("result", result); }); chrome.tabs.query( { currentWindow: true, active: true }, function (tabs) { settabid(tabs[0].id); console.log(tabs[0]); } ); chrome.debugger.sendCommand( { tabId: tabs[0].id }, "Network.emulateNetworkConditions", newtworkThrottleValues["offline"], () => { if (chrome.runtime.lastError) { console.log( "runtime.lastError", chrome.runtime.lastError.message ); return; } console.log("Debugger attached 3"); } ); } );
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Para acelerar la red para la página, tenemos que usar tabId y para iframes tenemos que pasar targetId en lugar de tabId

 chrome.tabs.query( { currentWindow: true, active: true }, function async(tabs) { await chrome.debugger.getTargets(async (result) => { const d = result.filter((value) => value.url.includes("url")); await chrome.debugger.attach( { tabId: tabs[0].id,}, "1.3", () => { if (chrome.runtime.lastError) { console.log( "runtime.lastError", chrome.runtime.lastError.message ); return; } console.log("Debugger attached"); } ); await chrome.debugger.sendCommand( { tabId: tabs[0].id }, "Network.enable", () => { if (chrome.runtime.lastError) { console.log( "runtime.lastError", chrome.runtime.lastError.message ); return; } console.log("Debugger attached"); } ); const newtworkThrottleValues = { offline: { downloadThroughput: 0, uploadThroughput: 0, latency: 0, offline: true, }, slow3G: { downloadThroughput: ((500 * 1024) / 8) * 0.8, uploadThroughput: ((500 * 1024) / 8) * 0.8, latency: 400 * 5, offline: false, }, fast3G: { downloadThroughput: ((1.6 * 1024 * 1024) / 8) * 0.9, uploadThroughput: ((750 * 1024) / 8) * 0.9, latency: 150 * 3.75, offline: false, }, online: { downloadThroughput: -1, uploadThroughput: -1, latency: 0, offline: false, }, }; await chrome.debugger.sendCommand( { tabId: tabs[0].id }, "Network.emulateNetworkConditions", newtworkThrottleValues["offline"], () => { if (chrome.runtime.lastError) { console.log( "runtime.lastError", chrome.runtime.lastError.message ); return; } console.log("Debugger attached 3"); } ); }); } ); };```
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda