Search code examples
javascriptgoogle-chromeclipboardaddress-barclipboarddata

Copy value to clipboard via Javascript command inserted in Address Bar


I'm able to get the current time of a Youtube playing video via inserting this JavaScript command to the address bar:

javascript:alert(document.querySelector('video').currentTime);

What I'm looking for is to get this video current time value to clipboard instead of displaying it within an alert box.


I'm using Chrome.


Solution

  • Copying to clipboard is easiest done using a lightweight open-source Javascript library. clipboard.js and clipboard-js both work in my experience.