Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

286
Visualizações
Javascript on paste: check if pasted content comes from word

Is it possible to check where a pasted content comes from? Because I need to check if a pasted content was copied from a word file...

So, is there something in javascript like:

  example.on('paste', function (event) {
     if (event.source == "Word") {
        // do something
     }
  }

Thanks in advance!

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

I need to remove all Office Codes. These are class-attributes starting with Mso

Why not check for what you need to fix?

const text = (event.clipboardData || window.clipboardData).getData('text')
if (text && text.toUpperCase().match(/"MSO/)) ...
about 4 years ago · Juan Pablo Isaza Relatório

0

I don't believe so, you need the clipboard API, and you only have access to executing the copy and paste commands. This will allow you to read or write content only.

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard

If you look at the clipboard API, you only get a read string or a DataTransfer instance. Which doesn't include any information on the source of the clipboard contents.

https://developer.mozilla.org/en-US/docs/Web/API/Clipboard

about 4 years ago · Juan Pablo Isaza Relatório

0

No that's not possible in web because if you copy any text from any source it will be same, And you are just copying that text, not source info, So that's impossible

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda