How to paste text into input fields that block it?

14

2

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.

syntagma

Posted 2015-05-26T10:18:07.190

Reputation: 323

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 – 2015-05-26T10:49:38.610

There are lots of way of circumventing such scripts and a dedicated browser extension should solve many wariants of this issue. – syntagma – 2015-05-26T10:54:20.740

1If you already know this, why do you post the question? – LPChip – 2015-05-26T10:56:29.187

I know it is doable, I don't know about any such extension. – syntagma – 2015-05-26T10:57:11.437

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 – 2017-07-18T03:05:23.380

If you use Linux you have a 2nd copy/paste buffer set, controlled by whatever the mouse has highlighted and middle button clickign to paste – ivanivan – 2018-03-14T18:19:36.093

Answers

13

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

This works for me in Firefox and Chrome.

HullCityFan852

Posted 2015-05-26T10:18:07.190

Reputation: 441

1Great 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 – 2018-10-04T18:08:47.933

This is the best. Trying to run js in the developer console was giving me a headache. Many thanks! – Millar248 – 2019-02-09T01:35:54.907

Cool, man? thank you.. You saved my time. – Vitali Petrov – 2019-12-04T08:12:24.890

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.

Junkiebev

Posted 2015-05-26T10:18:07.190

Reputation: 361

5

user276648

Posted 2015-05-26T10:18:07.190

Reputation: 161

1This 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 – 2018-06-24T13:48:11.117

For me, this extension helps, but does not work on all sites. – thin – 2018-10-04T18:10:38.520

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.

Mirrana

Posted 2015-05-26T10:18:07.190

Reputation: 672

2

Press F12 and paste the following code into the console.

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

Ahmad Sharif

Posted 2015-05-26T10:18:07.190

Reputation: 121

2

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

user373230

Posted 2015-05-26T10:18:07.190

Reputation:

2Carefully vet that extension before installing. Reviewers are claiming it's malware. – George – 2017-01-19T21:48:39.193

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

Legion

Posted 2015-05-26T10:18:07.190

Reputation: 111

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 – 2017-10-30T18:19:27.963

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.

Mokubai

Posted 2015-05-26T10:18:07.190

Reputation: 64 434

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

J. Does

Posted 2015-05-26T10:18:07.190

Reputation: 155

1I like this one: ^Q:: SendInput, {Raw}%clipboard%

CTRL-Q sends the contents of the keyboard as input (similar to typing it in) – nijave – 2018-08-16T01:25:16.507