Is an empty iframe src valid in JavaScript?

JavascriptWeb DevelopmentObject Oriented Programming

For empty iframe src, use the <iframe> element and set it like the following for an empty src −

<iframe src='about:blank'></iframe>


 Live Demo

<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initialscale=1.0">
<link rel="stylesheet" href="//">
<script src=""></script>
<script src=""></script>
<iframe src='about:blank'></iframe>

To run the above program, save the file name “anyName.html(index.html)” and right click on the file. Select the option “Open with Live Server” in VS Code editor.


This will produce the following output −

Updated on 02-Sep-2020 06:37:59