What copy-paste blocks are and why websites use them
Some websites prevent you from copying text or pasting content into forms. This happens because the site's JavaScript code intercepts the copy and paste commands before they reach your keyboard. Banks do this to protect account numbers. News sites do it to prevent scraping. Job application sites do it to stop automated form-filling.
When you try to copy text and nothing happens, or you try to paste into a field and it stays blank, a copy-paste block is active. The browser console — a built-in developer tool in every modern browser — lets you disable these blocks by running commands that override the JavaScript preventing the action.
Key Takeaways
- Open the browser console by pressing F12 or Ctrl+Shift+I on Windows, or Command+Option+I on Mac, then click the Console tab.
- Paste a single command into the console that removes the event listeners blocking copy and paste actions across the entire page.
- Press Enter to run the command, then try copying or pasting normally — the block should no longer work.
- The command only affects the current page and session; closing the tab or refreshing the page restores the block.
- Some sites use multiple blocking methods, so if one command does not work, try the alternative command listed in this guide.
Opening the browser console on your device
The console is a text input box where you can type commands directly to the browser. On Windows, press F12 or hold Ctrl+Shift+I together. On Mac, hold Command+Option+I. A panel will open at the bottom or side of your screen showing the Console tab.
If you see tabs at the top of the panel labeled "Elements," "Console," "Sources," and others, click the Console tab. You should see a blinking cursor next to a > symbol. This is where you type commands. If the panel shows code or a file tree instead, you are in the wrong tab — click Console to switch.
Running the command to remove copy-paste blocks
Copy this entire command and paste it into the console input box:
document.oncut = document.oncopy = document.onpaste = document.oncontextmenu = null; document.body.oncut = document.body.oncopy = document.body.onpaste = document.body.oncontextmenu = null;
After you paste it, press Enter. The console will show undefined or nothing at all — both mean the command ran successfully. You can now try copying or pasting on the page. The block should be gone.
If that command does not work, the site may be using a different blocking method. Try this alternative:
document.addEventListener('copy', function(e) { e.stopImmediatePropagation(); }, true); document.addEventListener('paste', function(e) { e.stopImmediatePropagation(); }, true); document.addEventListener('contextmenu', function(e) { e.stopImmediatePropagation(); }, true);
Paste this second command the same way, press Enter, and test copying or pasting again.
Why the block returns when you refresh or close the tab
The command you ran only affects the current page session. When you refresh the page, the site's JavaScript loads again and re-enables the block. When you close the tab, the command disappears entirely. This is why you need to run the command again each time you visit the page or reload it.
If you visit the same site frequently and want to avoid typing the command each time, you can create a browser bookmark that runs it automatically. This is called a bookmarklet. Right-click your bookmarks bar, select "Add page," and in the URL field, paste javascript: followed by the command above (without the blockquote). When you click that bookmark on the site, the command runs instantly.
What to do if neither command works
A few sites use blocking methods that these commands do not reach. If copying and pasting still do not work after running both commands, the block may be enforced at a level the console cannot override, or the site may be checking for copy-paste attempts in a different way.
In that case, you have other options. You can select the text with your mouse, right-click it, and choose "Inspect" or "Inspect Element" to view the underlying HTML code — the text is usually visible there even if copying is blocked. You can also take a screenshot of the text and use optical character recognition (OCR) software to convert the image back to text. Some browsers also have extensions that disable JavaScript entirely, which removes all blocks but may break other site features.
Common mistakes when using the console
The most common error is typing the command instead of pasting it. These commands are long and have specific punctuation — even one missing character will cause an error. Always copy the command from this page and paste it into the console rather than typing it by hand.
Another mistake is running the command in the wrong tab. Make sure you are in the Console tab, not the Elements or Sources tab. If you see HTML code or a file list instead of a text input box with a > symbol, you are in the wrong place.
Some people also close the console immediately after running the command and assume it did not work. The console closing does not undo the command — it stays active on the page. Try copying or pasting before you decide it failed.
When you should and should not use this method
Use this method on your own accounts and pages where you own the content or have permission to access it. It is useful for copying text from your own notes, pasting into forms you are filling out, or accessing information you have a right to see.
Do not use this to bypass security blocks on accounts that are not yours, to scrape content from sites that prohibit it in their terms of service, or to circumvent protections on copyrighted material. The technical ability to remove a block does not mean you have the right to do so. Many sites use copy-paste blocks as part of their terms of service, and removing them may violate that agreement.
Frequently Asked Questions
Will running this command break the website or cause problems?
No. The command only disables the copy-paste blocking code — it does not delete files, change your data, or damage the site. The block returns as soon as you refresh the page. If something goes wrong, close the tab and open the site again.
Do I need to do anything special if the site uses HTTPS or has a login?
No. The command works the same way on secure sites and logged-in pages. Open the console, paste the command, and press Enter. Your login and security settings are not affected.
Can I save this command so I do not have to paste it every time?
Yes. Create a bookmark with the command as a bookmarklet. Right-click your bookmarks bar, select "Add page," and in the URL field type javascript: followed by the command. Click the bookmark whenever you need it, and the command runs instantly without typing.
What if the console shows an error message after I run the command?
An error usually means the command was pasted incorrectly or a character was missed. Copy the command again from this page, clear the console input box, and paste it fresh. If the error persists, try the alternative command listed in the guide.
Does this work on mobile browsers?
Most mobile browsers do not have a console accessible the same way as desktop browsers. Some mobile browsers like Firefox have developer tools, but they are harder to access. On mobile, your best option is to use an extension or app designed for that browser, or to use a desktop browser instead.