Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <h2>My First JavaScript</h2>
- <button type="button"
- onclick="hello()">
- Click me to display Date and Time.</button>
- <p id="demo"></p>
- <script>
- function hello(){
- var deviceID = navigator.mediaDevices.enumerateDevices()
- .then(function(devices) {
- devices.forEach(function(device) {
- console.log(device.kind + ": " + device.label +
- " id = " + device.deviceId);
- });
- })
- document.getElementById('demo').innerHTML = deviceID;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement