Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

postmessage from iframe to parent

var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
var eventer = window[eventMethod];
var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";

// Listen to message from child window
eventer(messageEvent,function(e) {
    var key = e.message ? "message" : "data";
    var data = e[key];
    //run function//
},false);


//child page -    

parent.postMessage("loadMyOrders","*");  //  `*` on any domain       
Comment

PREVIOUS NEXT
Code Example
Javascript :: js addeventlistener hover 
Javascript :: how to split two digit number in javascript 
Javascript :: gulp synchronous tasks 
Javascript :: react history go back 
Javascript :: document print from html javascript 
Javascript :: convert string into bigNumber in ethers.js 
Javascript :: moment timezone get timezone offset 
Javascript :: discordjs eval 
Javascript :: new gatsby project 
Javascript :: how to hide javascript code 
Javascript :: This version of CLI is only compatible with Angular versions 0.0.0 || ^9.0.0-beta || =9.0.0 <10.0.0, but Angular version 10.0.14 was found instead. 
Javascript :: btoa javascript 
Javascript :: get url in js 
Javascript :: get last element in an array jqury 
Javascript :: how to handle all error of all router in express 
Javascript :: angular 404 on refresh 
Javascript :: node version check in cmd 
Javascript :: event.target data-target 
Javascript :: check value exist in array javascript 
Javascript :: how to kill all node processes in windows 
Javascript :: regex is empty string javascript 
Javascript :: js two array combining with id 
Javascript :: emit resize event in angular 
Javascript :: js input type range on hover 
Javascript :: javascript get now date yyyy-mm-dd 
Javascript :: reactjs make main div scrollable 
Javascript :: react-native android build apk 
Javascript :: how to capitalize first letter javascript 
Javascript :: js multiple url fetch 
Javascript :: disable a button in javascript 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =