Evento Load en Iframe con Chrome

215 views
Skip to first unread message

Carlos Admirador

unread,
Aug 17, 2022, 2:37:42 AM8/17/22
to AltNet-Hispano
No se lanza el evento Load de un Iframe cuando se está en Chrome?

Ni así:

<body onload="function(){ chatAsk(); }">

Ni así:

window.onload = function() {
        document.getElementById("log").innerHTML = "CHAT ask 2";
    }

Tampoco:

<iframe id="forPostyouradd" src="about:blank" width="800" height="400" style="background:#ffffff; display:block;" >
<script type="text/javascript">
        document.getElementById('forPostyouradd').onload = function() {
            alert('frame load');
        }
    </script>
  <p>Su navegador no es compatible con iframes</p>
</iframe>

Gabriel Osorio

unread,
Aug 17, 2022, 12:29:03 PM8/17/22
to altnet-hispano
Y así?
<iframe src="https://www.youtube.com/" onload="siteLoaded()"></iframe>
Eso dicen aquí:
https://www.delftstack.com/es/howto/javascript/iframe-onload/


--
Has recibido este mensaje porque estás suscrito al grupo "AltNet-Hispano" de Grupos de Google.
Para cancelar la suscripción a este grupo y dejar de recibir sus mensajes, envía un correo electrónico a altnet-hispan...@googlegroups.com.
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/altnet-hispano/be2626e6-7444-4984-b8ee-204d5889e9d7n%40googlegroups.com.

Carlos Admirador

unread,
Aug 18, 2022, 10:48:25 AM8/18/22
to AltNet-Hispano
Gracias, así funciona..

function loadFrameChat() {
 if (document.getElementById("frameChat").style.display == "none") return;
 document.getElementById("frameChat").contentDocument.defaultView.chatAsk();
}


function abrirChat () {
    document.getElementById("frameChat").style.display = "block";
    var iframe = $("#frameChat");
    iframe.attr("src", iframe.data("src"));
}

</script>
</head>
<body>

<b> PRUEBAS CHAT</b>
<br /><br />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<button id="btnAbriChat" onclick="abrirChat()">Abrir Chat</button>
<br /><br />

<div class="container">
<iframe id="frameChat" data-src="index.htm" src="about:blank" width="800" height="400"
class="responsive-iframe" style="background:#ffffff; display:none;" onload="loadFrameChat()">

  <p>Su navegador no es compatible con iframes</p>
</iframe>
</div>
Reply all
Reply to author
Forward
0 new messages