<script>
document.addEventListener("DOMContentLoaded", function() {
var adContent = '<!DOCTYPE html>'+
'<html lang="en">'+
'<head>'+
'<meta charset="UTF-8">'+
'<meta name="viewport" content="width=device-width, initial-scale=1.0">'+
'<title>Custom Ad</title>'+
'<style>'+
'body,html{margin:0;padding:0;overflow:hidden;width:100%;height:100%}'+
'.ad-container{display:flex;align-items:center;justify-content:center;width:100%;height:50px;background-color:#f1f1f1;border:1px solid #ccc;text-align:center;padding:10px;box-sizing:border-box;position:fixed;bottom:0;left:0;right:0;z-index:1000}'+
'.ad-content{width:320px;height:50px}'+
'.sticky{position:fixed;top:0}'+
'</style>'+
'</head>'+
'<body>'+
'<div id="adContainer" class="ad-container">'+
'<div class="ad-content">'+
'<h1>Ad Title</h1>'+
'<p>This is a custom ad.</p>'+
'<a href="https://example.com" target="_blank">Learn More</a>'+
'</div>'+
'</div>'+
'<script>'+
'window.onscroll=function(){toggleStickyAd();alert("b")};'+
'function toggleStickyAd(){var adContainer=document.getElementById("adContainer");if(window.scrollY>100){adContainer.classList.add("sticky")}else{adContainer.classList.remove("sticky")}}'+
'</'+'script>'+
'</body>'+
'</html>';
var iframe = document.createElement('iframe');
iframe.id = 'iframe1';
iframe.style.width = '320px';
iframe.style.height = '50px';
iframe.style.border = 'none';
iframe.style.position = 'fixed';
iframe.style.top = '0';
iframe.style.right = '0';
iframe.style.zIndex = '1000';
var iframe2 = document.createElement('iframe');
iframe2.id = 'iframe2';
iframe2.style.width = '320px';
iframe2.style.height = '50px';
iframe2.style.border = 'none';
iframe2.style.position = 'fixed';
iframe2.style.bottom = '0';
iframe2.style.left = '0';
iframe2.style.zIndex = '1000';
window.onscroll=function(){toggleStickyAd()};
function toggleStickyAd(){var adContainer=document.getElementById("adContainer");if(window.scrollY>100){adContainer.classList.add("sticky")}else{adContainer.classList.remove("sticky")}};
document.body.appendChild(iframe);
document.body.appendChild(iframe2);
handleIframeLoad('iframe1');
handleIframeLoad('iframe2');
function handleIframeLoad(iframeId) {
var iframe = document.getElementById(iframeId);
var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
iframeDoc.open();
iframeDoc.write(adContent);
iframeDoc.close();
}
});
</script>
1
1
1KB
3KB
108.0ms
ms
123.0ms