@acjnas document.write
is not the right way to inject I would rather have a container div element and then append iframe into that div via the following code like snippet
<div id="targetDiv"></div>
<script>
// Select the div where you want to insert the iframe
var targetDiv = document.getElementById('targetDiv');
// Create the iframe element
var iframe = document.createElement('iframe');
// Set the attributes for the iframe
iframe.setAttribute('src', 'https://www.example.com');
iframe.setAttribute('width', '600');
iframe.setAttribute('height', '400');
iframe.setAttribute('frameborder', '0'); // Optional: Set to 0 for no border
iframe.setAttribute('allowfullscreen', 'true'); // Optional: Allow full screen
// Append the iframe to the selected div
targetDiv.appendChild(iframe);
</script>