JSFiddle - React, Tailwind, and code Playground
by masteram
JavaScript
// Create iframe
$(document).on('custom', function (e, param) {
console.log(arguments); // [object Object] -> normal jQuery event data without any special data
});
var iframe = document.createElement('iframe');
iframe.setAttribute('src', 'http://stallman.org/');
document.body.appendChild(iframe);
// Event itself
var event = document.createEvent('HTMLEvents');
event.custom = 'example param';
event.initEvent('custom', false, true);
iframe.contentWindow.window.document.dispatchEvent(event);
console.log(iframe);