Interview Question

What is sandbox attribute in iframe?

Sandbox restricts what embedded iframe content may do.

💡 Concept ✅ Quick Revision 🌐 HTML

Answer

The `sandbox` attribute places safety limits on content inside an iframe. β€’ It is written inside an element’s opening tag. β€’ The HTML Standard limits which elements may use it and which values are valid. β€’ Browsers apply the attribute when they process the element or the resource it controls.

💡 Simple Example

<iframe src="demo.html" sandbox></iframe>

⚡ Quick Revision

Sandbox restricts what embedded iframe content may do.