HTMLIFrameElement | Htmldom

 

Descripción

HTMLIFrameElement es un interface que proporciona acceso a las propiedades y los métodos de un elemento iframe.

Sintaxis

HTMLIFrameElement

Constructores

  • N/A

Propiedades

  • contentDocument
  • contentWindow
  • featurePolicy
  • referrerPolicy
  • src
  • srcDoc

Métodos

  • N/A

Eventos

  • N/A

Ejemplo

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Web Messaging</title>
</head>
<body>

	<h1>Web Messaging</h1>
	<button id="boton">Enviar Mensaje</button>
	<br><br>
	
	<iframe id="myiframe" src="iframe.html"></iframe>
	
	<script>
    boton = document.getElementById("boton");
    boton.addEventListener("click",function() {
      myiframe = document.getElementById("myiframe");
      myiframe.contentWindow.postMessage("Mensaje",'*');
    });
	</script>

</body>
</html>

Artículos