Open charlescatta opened 7 years ago
The Web Bluetooth API is blocked in cross origin iframes.
ROOT: https://www.webcomponents.org/element/PolymerElements/platinum-bluetooth/demo/demo/ IFRAME: https://user-content-dot-custom-elements.appspot.com/PolymerElements/platinum-bluetooth/v2.1.2/platinum-bluetooth/demo/index.html
@dstockwell Is there anything you could do to fix that? It used to work great.
See https://bugs.chromium.org/p/chromium/issues/detail?id=518042 for more info. @jyasskin WDYT we can do there?
Once Feature Policy launches, we'll be able to use its iframe attributes to delegate the API to the other origin. Until then, there's no fix beyond keeping the iframes on the same origin or opening the demo in a new top-level frame.
Description
Since webcomponents.org uses iframes to display demos, a SecurityError is raised since the browser api call is made from a cross-origin iframe.
Expected outcome
For the element to display information based on the button clicked: Ex: Clicking the "Get Battery Level" button will display the battery level
Actual outcome
Clicking the "Get Battery Level" displays Argh! SecurityError: requestDevice() called from cross-origin iframe.
Live Demo
https://www.webcomponents.org/element/PolymerElements/platinum-bluetooth/demo/demo/
Steps to reproduce
Make sure you are using the new webcomponents.org layout browse for the platinum-bluetooth polymer element open the demo try to click on any button
Browsers Affected
Possible Solution
Detect if we are in an iframe, if so ask user if he wants to open the demo in a new window.