Background
I need to integrate video ads in our service (Mobile Web page)
Our product delivers ads via Delivery system.
We used iframe to make close env for ad layout not to conflict (errors) with ad layout, and our web page is single page application, and not to good with some javascript to integrate current our ad system
But this video ads needs to access original page DOM to arrange timing to start video
But, cannot access from general iframe
Friendly iframe
Ads(inside of iframe) can access, original and get referer.
Friendly iframe definition from iab
iab describe
- Create an IFrame element and place it into the document with SRC set to about:self
- Create a Script element and place it into the IFrame document with SRC set to the ad delivery system
- Generate a variable called inDapIF = true in the IFrame document to identify to the ad code that it is running inside the Dynamic IFrame.
Sample Codes
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script src=""></script> </head> <body> <iframe id="friendly"></iframe> <script> (function() { var iframe = document.getElementById("friendly"); iframe.width = 300; iframe.height = 250; iframe.frameBorder = "0"; iframe.scrolling = "no"; iframe.marginWidth = 0; iframe.marginHeight = 0; iframe.src = "about:self"; var src =""; // Advertisement Script URL var doc = iframe.contentDocument? iframe.contentDocument : iframe.contentWindow.document; doc.open(); var d = ''; d += '<html><head></head>'; d += '<body>'; d += '<script src=\"' +src+ '\"><\/script>'; d += '<script>inDapIF = true;<\/script>'; d += '</body></html>'; doc.write(d); doc.close(); })(); </script> </body> </html>
ad script javascript call advertisement codes with async
コメント