krakenjs / zoid

Cross domain components
Apache License 2.0
2.03k stars 248 forks source link

Enhancement: Add Custom Attributes to the iFrame #145

Closed rjdlee closed 6 years ago

rjdlee commented 6 years ago

If the contents of the iFrame requires access to geolocation, camera, or audio, you need to set an attribute on the iFrame (https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-permissions-in-cross-origin-iframes).

I tried doing the following, but it gets overwritten by something:

xclogin.LoginXComponent.render({...}, '#container').then(() => {
          const iframe = document.getElementById('container').querySelector('iframe');
          iframe.setAttribute('allow', 'camera');
})
bluepnume commented 6 years ago

You can do this today when you call xcomponent.create -- see example here:

https://github.com/paypal/paypal-checkout/blob/master/src/button/component.jsx#L156-L160

    attributes: {
        iframe: {
            foo: 'bar'
        }
    }
rjdlee commented 6 years ago

Thanks, might be a good idea to add it to the documentation.