sandbox
The sandbox attribute puts extra limits on the page inside an iframe. An empty sandbox blocks scripts, forms, popups, and top-level navigation, and gives the page a unique origin. Each token you add gives one power back.
HTML attribute
Updated
On this page
Example
HTML
<!-- All limits: no scripts, no forms, no popups --> <iframe src="https://widget.example/ad" sandbox title="Ad"></iframe> <!-- Scripts and forms only --> <iframe src="https://widget.example/form" sandbox="allow-scripts allow-forms" title="Form"></iframe>
Tokens are separated by spaces. Each token removes one limit.
How to set it
Start with an empty sandbox. Then add only the tokens the framed page needs.
<iframe src="https://widget.example/form" sandbox="allow-scripts allow-forms allow-popups" title="Partner form" ></iframe>
Do not use allow-scripts with allow-same-origin when the frame has the same origin as your page. The frame can then remove its own sandbox.
Learn more
Sources