Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

285
Views
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 answers
Answer question

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 Report

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!