Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.49 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <h2>My First JavaScript</h2>
  6.  
  7. <button type="button"
  8. onclick="hello()">
  9. Click me to display Date and Time.</button>
  10.  
  11. <p id="demo"></p>
  12.  
  13. <script>
  14. function hello(){
  15.     var deviceID = navigator.mediaDevices.enumerateDevices()
  16. .then(function(devices) {
  17.   devices.forEach(function(device) {
  18.     console.log(device.kind + ": " + device.label +
  19.                 " id = " + device.deviceId);
  20.   });
  21. })
  22.     document.getElementById('demo').innerHTML = deviceID;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement