13

On many webpages they are blocking copy/paste using JavaScript.

Is there any way for making such inputs work as the should (e.g. enable copy/paste)?

I’m using Google Chrome.

  • Its very unlikely. They don't put in that for no reason, so they'll also block any kind of way to circumvent it. – LPChip May 26 '15 at 10:49
  • There are lots of way of circumventing such scripts and a dedicated browser extension should solve many wariants of this issue. – syntagma May 26 '15 at 10:54
  • 1
    If you already know this, why do you post the question? – LPChip May 26 '15 at 10:56
  • I know it is doable, I don't know about any such extension. – syntagma May 26 '15 at 10:57
  • If you were using Firefox, you could go to about:config and change dom.event.clipboardevents.enabled to false. I don't know if something similar exists in Chrome. – user276648 Jul 18 '17 at 3:05
11

Simply highlight the text and drag it into the text field. Try it here!

This works for me in Firefox and Chrome.

  • Great solution! In chrome you can put this string into the address bar "data:text/html, <html contenteditable>" (without the quotes) to get a blank canvas. I created a bookmark to that. Now I can paste my text into this blank page, then drag it into the fields that need filling. – thin Oct 4 '18 at 18:08
  • This is the best. Trying to run js in the developer console was giving me a headache. Many thanks! – Millar248 Feb 9 at 1:35
7

It's hacky and won't work always but a lot of the time there is just a listener set for CTRL+C / CTRL+V and you can get around it by using CTRL+INS / SHIFT+INS instead of copy / paste.

If they are doing something goofy like using flash to write an empty string to the clipboard in a loop (twitch) then you are out of luck.

5

Here's an open source Chrome Extention

https://chrome.google.com/webstore/detail/dont-fuck-with-paste/nkgllhigpcljnhoakjkgaieabnkmgdkb

If you're interested in the code https://github.com/jswanner/DontFuckWithPaste

  • 1
    This should be the correct answer. Don't Fuck With Paste has 465 stars on Github and practically a 5 star rating on the Chrome Store - with 413 reviews. This really helped me. Thanks! – Ben Jun 24 '18 at 13:48
  • For me, this extension helps, but does not work on all sites. – thin Oct 4 '18 at 18:10
5

If you're using Firefox, I found the following solution. Not sure what minimum version is required, however.

  1. Go to about:config
  2. Search for dom.event.clipboardevents.enabled
  3. Double-click it to change the value to false

This allowed me to paste immediately after changing it. I didn't even have to restart the browser.

2

The easiest workaround (in terms of user-friendliness) for Google Chrome would be adding Allow Copy extension.

  • 2
    Carefully vet that extension before installing. Reviewers are claiming it's malware. – George Jan 19 '17 at 21:48
1

You could simply disable JavaScript on the page using a simple bookmarklet. From. http://javascript.about.com/library/bldis.htm

If you create a bookmark that contains the following script as the link (or even paste this code into the address bar and press enter) then it will rip all the JavaScript off of the current page:

javascript:void(d=document);if(frames.length){alert('Script%20doesn/'t%20work%20in%20frames');}else{while((el=d.getElementsByTagName('script')).length){el[0].parentNode.removeChild(el[0]);};onerror=function(){};d.close();}

The problem of course is that while you will now be able to paste into that text box if the form used JavaScript to submit the form then that too will be broken.

1

Decide to add my solution to this (making a bookmarklet inspired from this repo and extension https://github.com/jswanner/DontFuckWithPaste) This bookmarklet will also allow copying on documents that disable that using javascript.

javascript:(function(){
  allowCopyAndPaste = function(e){ 
      e.stopImmediatePropagation(); 
      return true;
  };
  document.addEventListener('copy', allowCopyAndPaste, true);
  document.addEventListener('paste', allowCopyAndPaste, true);
  document.addEventListener('onpaste', allowCopyAndPaste, true);
})();

AllowCopyAndPaste

  • Please do not post the same answer to multiple questions. If the same information really answers both questions, then one question (usually the newer one) should be closed as a duplicate of the other. You can indicate this by voting to close it as a duplicate or, if you don't have enough reputation for that, raise a flag to indicate that it's a duplicate. Otherwise tailor your answer to this question and don't just paste the same answer in multiple places. – DavidPostill Oct 30 '17 at 18:19
0

On windows you can use AutoHotkey

syntax:

::whatever::
Send [....text… Use  {enter} for line breaks]
return

example: if you type xyz it will write the text below (as if it was written)

::xyz::
Send hi {enter} This a new line  {enter}. Another new line  {enter} whatsoever. {enter} 
return
  • 1
    I like this one: ^Q:: SendInput, {Raw}%clipboard% CTRL-Q sends the contents of the keyboard as input (similar to typing it in) – nijave Aug 16 '18 at 1:25
0

Press F12 and paste the following code into the console.

var allowPaste = function(e){
  e.stopImmediatePropagation();
  return true;
};
document.addEventListener('paste', allowPaste, true);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.