

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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);
- Related Questions & Answers
- Cross domain HTML5 iframe issue
- Alternatives to HTML5 iframe srcdoc?
- jQuery parent > child Selector
- Setting Cross Browser Opacity using CSS
- Best Cross Browser Compatibility Testing Tools
- Is their any alternative to HTML5 iframe srcdoc?
- How to send a cross-document message with HTML?
- Process vs Parent Process vs Child Process
- 20 Best Cross Browser Compatibility Testing Tools
- Cross-origin data in HTML5 Canvas
- Cross-browser drag-and-drop HTML file upload?
- Cross Browser Solution for Image Marker in CSS
- How to call a parent window function from an iframe using JavaScript?
- HTML5 applicationCache vs Browser Cache
- How to call parent constructor in child class in PHP?
Advertisements