< >

beispiel-iframe.html


Quell Code


<!DOCTYPE html>
<html>
<head>
    <style>
		
	</style>
	<script>
document.addEventListener("message", function(e){
        document.getElementById("test").textContent =
                e.domain + " said: " + e.data;
}, false);






		window.addEventListener('message',function(event) {
			if(event.origin != 'https://davidwalsh.name') return;
			console.log('scriptandstyle.com:  message received:  ' + event.data,event);
			event.source.postMessage('holla back youngin!',event.origin);
                document.getElementById('test1').innerHTML=event.data;
		},false);
	</script>
</head>
<body>
	
	<b>This iframe is located on https://sebastian1012.bplaced.net/</b>
<div id="test">Send me a message!</div>
<div id="test1">2</div>
	
	
	
</body>
</html>