Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
HTML5 Cross Browser iframe post message - child to parent?
The parent object provides a reference to the main window from the child.
The following is the parent code. The directive below triggers the iFrame to send a message to the parent window every 3 seconds. No initial message from the main window needed!
var a= window.addEventListener ? "addEventListener" : "attachEvent";// here a is the event method
var b= window[a];// here b is the eventer
var c= a== "attachEvent" ? "onmessage" : "message";// here c is the message event
// Listen to message from child window
b (c,function(e) {
var d= e.message ? "message" : "data";// here d is the key
var f= e[d];//here f is data
},false); Advertisements
