Blocking Website Clipboard Hijacking in Firefox

This article explores the dom.event.clipboardevents.enabled preference in the Mozilla Firefox web browser and how it protects user control and privacy. By modifying this single configuration setting, users can prevent websites from detecting, blocking, or altering their copy, cut, and paste actions. Below is a straightforward breakdown of how websites manipulate clipboard behavior, the exact effect of disabling this preference, the potential side effects on modern web applications, and how to change the setting yourself.

How Websites Abuse Clipboard Events

Normally, browsers allow websites to use JavaScript to listen for copy, cut, and paste events. While this is meant to support advanced web functionality, many websites use these events to restrict users or modify their data. Common examples of clipboard manipulation include:

  • Hijacking copied text: Automatically appending source links, copyright notices, or tracking URLs to the end of text you copy from an article.
  • Blocking copy actions: Preventing users from copying text on a webpage to deter plagiarism or scraping.
  • Blocking paste actions: Disabling the ability to paste text into input fields, most commonly seen in "Confirm Email" or "Password" boxes, which frustrates password manager users.
  • Data harvesting: Detecting when a user pastes information into a page to immediately capture it before they even hit a submit button.

The Effect of dom.event.clipboardevents.enabled

In Firefox, the dom.event.clipboardevents.enabled preference dictates whether the browser informs a webpage that a copy, cut, or paste action has occurred. By default, this preference is set to true.

When you change this preference to false, Firefox completely blinds websites to your clipboard activity. The copy, cut, and paste functions still work normally for you at the operating system level, but the browser stops firing the corresponding JavaScript events to the webpage.

Setting this preference to false results in the following immediate effects:

  • Unaltered Copying: You will only ever copy the exact text you highlighted. Websites can no longer inject "Read more at..." links into your clipboard.
  • Unrestricted Pasting: Websites can no longer block you from using Ctrl+V (or Cmd+V) or the right-click context menu to paste passwords and emails into form fields.
  • Bypassing Copy Restrictions: Websites that use JavaScript to block the copy command will fail to stop you from copying their text.
  • Enhanced Privacy: Scripts running in the background of a webpage cannot monitor how often you copy or cut text, nor can they trigger hidden actions when you do so.

The Drawbacks of Disabling Clipboard Events

While disabling this preference is great for reading articles and filling out basic forms, it will break legitimate features on complex web applications.

Modern productivity tools—such as Google Docs, Microsoft Word Online, Notion, and web-based email clients—rely heavily on clipboard events to function properly. They use these events to maintain text formatting, handle custom layouts, and allow you to paste images directly from your clipboard. If dom.event.clipboardevents.enabled is set to false, copying and pasting within these specific applications may strip all formatting, fail to paste images, or stop working altogether.

How to Modify the Preference in Firefox

If you want to prevent websites from interfering with your clipboard, you can disable the setting in a few steps:

  1. Open a new tab in Firefox, type about:config into the address bar, and press Enter.
  2. Click the Accept the Risk and Continue button on the warning page.
  3. In the search bar at the top, type dom.event.clipboardevents.enabled.
  4. Locate the preference in the list and click the Toggle icon on the right (or double-click the row) to change its value from true to false.

The change takes effect immediately. If you ever encounter a web application where copying and pasting stops working correctly, you can return to this menu and toggle the setting back to true.