Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I allow download in sandboxed iframe using Javascript?

<iframe sandbox="allow-forms allow-scripts allow-same-origin" src="HTML_HERE" id="iframe"></iframe>

This is the sandboxed iframe, you are not allowed to modify this and add 'allow-downloads' or any sandbox properties. You need Javascript to sove this.

like image 635
MLSNK Avatar asked Oct 31 '25 18:10

MLSNK


1 Answers

'allow-downloads' is newly introduced value for the sandbox attribute in the iframe.

sandbox="allow-downloads"

Reference: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#browser_compatibility

like image 57
mahesh kajale Avatar answered Nov 02 '25 08:11

mahesh kajale



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!