<!DOCTYPE html>
<meta charset="utf-8">
<title>Page with third-party iframe</title>
<body>
<script>
function addIframe(url) {
return new Promise(resolve => {
const iframe = document.createElement('iframe');
iframe.src = url;
iframe.onload = () => {resolve(true);};
document.body.appendChild(iframe);
});
}
</script>
</body>