SHARE
TWEET

Untitled

a guest Jan 28th, 2020 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top