xm einen IFrame nachträglich auszublenden wenn dieser leer geblieben ist gehen Sie wie folgt vor:
- Fügen Sie ein <div> oder <span> Element in Ihrer Webseite um den Werbeflächen-Code herum und geben Sie diesem Element eine eindeutige ID.
<div id="placement123">... Werbflächen-Code ...</div>
- Paste the following script for the ad space.
<script>
function receiver123(event)
{
if(event.data && typeof(event.data) == "string" && event.data == "hide:123")
{
var d = document.getElementById("placement123");
if(d){ d.style.display = "none"; }
}
}
window.addEventListener("message", receiver123, false);
</script> - Sample code in the website:
<div id="placement123">... Werbflächen-Code ...</div>
<script>
function receiver123(event)
{
if(event.data && typeof(event.data) == "string" && event.data == "hide:123")
{
var d = document.getElementById("placement123");
if(d){ d.style.display = "none"; }
}
}
window.addEventListener("message", receiver123, false);
</script> - If you use multiple advertising space, please make sure that the ID of the <div> and the function name in the script are clearly ( "placement123" and "receiver123" in the example)
- Leave in the advertising space in the ad server as the default code following script:
<script>
Make sure that the code on the page match right in the advertising space with the code ( "hide: 123").
top.postMessage("hide:123","*");
</script>
![]() |
Note: |