nprapps / pym.js

Resize an iframe responsively depending on the height of its content and the width of its container.
http://blog.apps.npr.org/pym.js/
MIT License
808 stars 114 forks source link

Adding "allow" attribute to iframe tag #200

Open johndhancock opened 10 months ago

johndhancock commented 10 months ago

Is it possible to add the allow attribute as one of the configuration options for the parent instance?

I have an embed that attempts to use the user's location via the geolocation api in the browser to customize content of the embed. In order to do this is in the generated iframe, I need to add the allow parameter to the iframe tag with a value of 'geolocation'.

thomaswilburn commented 10 months ago

You may want to look at Sidechain, which is Pym-compatible and supports allow attribute pass-through: https://github.com/nprapps/sidechain

johndhancock commented 10 months ago

Thanks for the tip. Forgive me if I'm missing it, but is there documentation on how to pass through the attribute?

thomaswilburn commented 10 months ago

There isn't, I never added documentation for it. But if you set <side-chain src="..." allow="..."></side-chain>, it should carry it through to the internal iframe.