video-ad-sdk
Version:
VAST/VPAID SDK that allows video ads to be played on top of any player
17 lines (16 loc) • 587 B
JavaScript
export const createIframeResource = (source, { document, data }) => {
const { height, width } = data;
const iframeElement = document.createElement('iframe');
iframeElement.setAttribute('sandbox', 'allow-forms allow-popups allow-scripts');
iframeElement.setAttribute('loading', 'eager');
if (width) {
iframeElement.width = width.toString();
}
if (height) {
iframeElement.height = height.toString();
}
iframeElement.src = source;
iframeElement.frameBorder = '0';
iframeElement.style.border = 'none';
return iframeElement;
};