TIL iframe sandbox attribute
POSTED ON:
TAGS: html javascript
The <iframe>
HTML element represents a nested browsing context, embedding another HTML page into the current one.
It can be abused.
<iframe sandbox>
allows you to lock it down. If some form tried to submit something in there: nope, won’t work. What if it tries to trigger a download? Nope. Ask for device access? No way. It can’t even load any JavaScript at all.
What you can do is unlock it by doing:
<iframe sandbox="allow-downloads">
There's actually a huge list of restrictions you can unlock, if you want fine control over the iframe in the MDN
Learned in:
Choice Words about the Upcoming Deprecation of JavaScript Dialogs
Related TILs
Tagged: html