Okay, I understand. The CSS properties like display: none or user-select: none affect how the browser displays or interacts with the element on the page, but they don't remove the element's data from the page's structure. When you copy content, the browser might still include the <img> tag itself in the copied HTML, leading to the favicon being pasted.
To address this, we need to use JavaScript to actually remove the favicon elements from the page's Document Object Model (DOM) before you attempt to copy the content.
This requires a User Script Manager extension like Tampermonkey (available for Chrome, Firefox, Edge, Opera, Safari) or Violentmonkey, as this is no longer strictly a CSS modification.
Here's the JavaScript code you would use:
// ==UserScript==
// @name Remove Favicons for Copying
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Removes favicon images from pages to prevent them from being copied into applications like MarkText.
// @author You / AI
// @match https://*/* // This will apply the script to all HTTPS websites. Adjust if needed.
// @exclude https://www.example.com/* // Add specific sites you DON'T want this to run on, if any.
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Function to remove the favicon elements
function removeFavicons() {
// Select all image elements that have the class 'favicon'
const faviconsToRemove = document.querySelectorAll('img.favicon');
// Iterate through the found elements and remove them from the DOM
faviconsToRemove.forEach(favicon => {
if (favicon && favicon.parentNode) {
favicon.remove(); // Use the modern .remove() method
}
});
// Optional: Log how many were removed for debugging
// console.log(`Removed ${faviconsToRemove.length} favicon elements.`);
}
// Run the function immediately when the page loads
removeFavicons();
// Optional: If favicons might be loaded dynamically after the initial page load,
// you could use a MutationObserver to watch for changes and remove them as they appear.
// For many cases, running once on load is sufficient.
// Example of MutationObserver (more advanced, might not be needed):
/*
const observer = new MutationObserver(mutations => {
mutations.forEach(mutation => {
if (mutation.addedNodes) {
mutation.addedNodes.forEach(node => {
if (node.nodeType === Node.ELEMENT_NODE) {
// Check if the added node itself is a favicon
if (node.matches('img.favicon')) {
node.remove();
}
// Check if any child nodes are favicons
node.querySelectorAll('img.favicon').forEach(favicon => favicon.remove());
}
});
}
});
});
observer.observe(document.body, { childList: true, subtree: true });
*/
})();