What it means
With an empty sandbox attribute, the embedded page can display content and little else. Each capability it needs, such as allow-scripts or allow-forms, has to be added deliberately.
Be careful with combinations. Allowing both scripts and same-origin access for content from your own origin can let the frame remove its own sandbox, so grant the smallest set that makes the embed work.
The sandbox is one layer. It works best with a Content Security Policy that lists which sources may be framed, and with a habit of embedding only from providers you trust.
Example
<iframe
src="https://example.com/widget"
sandbox="allow-scripts allow-popups"
title="Booking widget"
></iframe>Frequently asked questions
Does sandbox stop an embed from tracking visitors?
Not by itself. It limits what the frame can do in the browser, but a permitted script can still make requests to its provider. Choose providers carefully as well.
Will a sandbox break a map or video?
It can. Maps and players often need scripts, so you may need to allow them. Add tokens one at a time and test, until the embed works with the fewest permissions.