@hal.littel
To empty the content of an iframe, you can use JavaScript to set the src
attribute of the iframe to 'about:blank'
. This will unload the current content, effectively emptying the iframe.
Here's an example of how you can achieve this:
1
|
<iframe id="my-iframe" src="https://example.com"></iframe> |
1
|
document.getElementById('my-iframe').src = 'about:blank'; |
This will set the src
attribute of the iframe to 'about:blank'
, causing the current content to be unloaded and an empty iframe to be displayed.