1

I am trying to capture a ctrl+v event on-site create with vue.js, in this site, there isn't any form but there are a few buttons, so I want to detect the ctrl+v event Independently of if the user did click in any button previously or not.

Is this possible?

How can do it?

Tlaloc-ES
  • 4,825
  • 7
  • 38
  • 84
  • 3
    Please don't block pasting, *especially* on password fields. People use password managers. People have passwords that are impractical to type in. People have accessibility needs. – tadman Jul 14 '20 at 17:38
  • Edited, I don't want to cancel, I want to detect the ctrl+v on anywhere place, but I don't want to put in every place the event to capture the ctrl+v – Tlaloc-ES Jul 14 '20 at 17:42
  • 1
    @tadman It's entirely possible to paste to the page. If I go to https://imgur.com/ and paste when I've got an image in my clipboard, it uploads. No focus required. – ceejayoz Jul 14 '20 at 17:48
  • @ceejayoz Always presumed they had some kind of invisible yet focused element to capture that, but could be wrong! – tadman Jul 14 '20 at 17:59
  • So, could I force the focus of any way? – Tlaloc-ES Jul 14 '20 at 18:05
  • 1
    https://developer.mozilla.org/en-US/docs/Web/API/Document/paste_event – Bergi Jul 14 '20 at 18:07

0 Answers0