analytics/assets/js/embed.content.js
Uku Taht 7d37208d52
Allow custom styles to be passed to embedded iframe (#1522)
* Allow custom styles to be passed to embedded iframe

* Changelog
2021-12-08 11:53:37 +02:00

17 lines
351 B
JavaScript

import 'iframe-resizer/js/iframeResizer.contentWindow'
window.iFrameResizer = {
onMessage: function(msg) {
if (msg.type === 'load-custom-styles') {
addCustomStyles(msg.opts)
}
}
}
function addCustomStyles(opts) {
var style = document.createElement('style');
style.innerHTML = opts.styles
document.head.appendChild(style);
}