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

221
Visualizações
How can I get Chrome's script debugger to breakpoint on <iframe> loading?

I am trying to understand how iframe calls the URL specified in its src attribute. When we look at the network tab in Chrome developer tools, the Type column shows as "document".

Consider the below HTML snippet

<!DOCTYPE html>
<html>
<body>

<h1>The iframe element</h1>

<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3549.400553850174!2d78.03995351513306!3d27.175144783015277!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x39747121d702ff6d%3A0xdd2ae4803f767dde!2sTaj%20Mahal!5e0!3m2!1sen!2sin!4v1660205543740!5m2!1sen!2sin" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>

</body>
</html>
enter image description here

In case of fetch API, the type is seen as fetch. enter image description here Similarly, when we make xmlHTTPRequest() the type is xhr.

So, I have the below questions:

  1. What does type "document" in case of iframe indicate?
  2. Which native JS method does iframe use to load the URL in its src attribute?
  3. Since, I cannot use xhr breakpoint, how to add a breakpoint in Chrome Developer tools before the URL in iframe's src attribute is about to be invoke(not sure if that's the correct terminology here)?
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

What does type "document" in case of iframe indicate?

That the URL points to an (in this case HTML) document.

Which native JS method does iframe use to load the URL in its src attribute?

None.

Browsers provide APIs to let webpages execute JavaScript in a page and interact with the browser in various ways.

They tend not to be written in JavaScript or use it for most of their internal operations. (C++ is more common).

about 4 years ago · Juan Pablo Isaza Relatório

0

What does type "document" in case of iframe indicate?

That the browser made the request for a HTML document to show in a user-facing browser window, just like Netscape 1.0 did back in the day.

Which native JS method does iframe use to load the URL in its src attribute?

  • No JavaScript is involved. Nor "Native JS" (whatever that means...).
  • But I assume whatever code is involved is somewhere in here: https://github.com/chromium/chromium/tree/main/net/http

Since, I cannot use xhr breakpoint, how to add a breakpoint in Chrome Developer tools before the URL in iframe's src attribute is about to be invoke(not sure if that's the correct terminology here)?

There are two options, and you can use both together:

  1. The Navigation and Resource Timings API in the DOM supported by most browsers.
    • Basically you have a <script> at the very top of your <head> that listens for navigationStart events that bubble-up the DOM, and you can put a breakpoint in there if you like.
    • https://developer.mozilla.org/en-US/docs/Web/Performance/Navigation_and_resource_timings
  2. Chrome Developer Tools' built-in "Event Listener Breakpoints".
    • Go to the Sources tab and open the right-hand list to select the top-level "Load" and "Window" events. Once checked, the debugger will break when any iframe in the current document raises any of those events (especially load and navigate).

    • Like so: enter image description here

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