| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <script> | |
| 3 window.onmessage = messageEvent => { | |
| 4 if (messageEvent.data === 'Go') { | |
| 5 navigator.bluetooth.requestDevice({ | |
| 6 filters: [{services: ['generic_access']}] | |
| 7 }).then(device => { | |
| 8 if (device.constructor.name === "BluetoothDevice") { | |
| 9 parent.postMessage('Success', '*'); | |
| 10 } else { | |
| 11 parent.postMessage('FAIL: requestDevice in iframe returned ' + device,
'*'); | |
| 12 } | |
| 13 }).catch(err => { | |
| 14 console.error(err); | |
| 15 parent.postMessage('FAIL: ' + err, '*'); | |
| 16 }); | |
| 17 } | |
| 18 }; | |
| 19 parent.postMessage("Ready", "*"); | |
| 20 </script> | |
| OLD | NEW |