5 ms·
I feel like if you've selected some text, then pressing copy should always copy that text and nothing else. But then: what's to stop websites from detecting yo
by zebracanevra 4y ago
I feel like if you've selected some text, then pressing copy should always copy that text and nothing else.
But then: what's to stop websites from detecting you've selected text, unselecting it, and copying the bad text in, and then reselecting it...
There are so many loopholes I can imagine to get around these restrictions :(
- justahuman74 4y agoWhy are websites allowed to know that you've selected plain text? (genuinely clueless on web stuff)
- zebracanevra 4y agoI think there are a bunch of decent uses for that, like rich text editors (eg select text, hit ctrl-b, and the text is bolded). There are also some sites that popup a small box above your selection with a share box. Straight to hell with those. Compulsive selectors go mad on those sites. That's you, medium.com.
- denton-scratch 4y agoBut why does a rich text editor need to talk to a website?
- LocalH 4y agoWhat if the rich text editor and the website are the same thing? What if the rich text editor is part of a larger tool that is the website?
- denton-scratch 4y agoWell, I'm not sure what you're waving at. If the website is nothing more than a RTE, then it's better (and safer) to do it in the browser. If the RTE is just part of the website, then that's a part that's better done in the browser. Perhaps you want a RTE that doesn't depend on JS. I think that's a reasonable thing to want; but if you normally browse with JS switched off, then running into a working RTE is at least going to violate the Principle of Least Surprise.
- entropie 4y agoWhy are websites allowed to know that I hover an element? Javascript knows about clicks, doubleclicks, hovers... like almost every interaction the user does. There are use cases but also potential to be exploited somehow.
- paulryanrogers 4y agoBecause websites are apps now. The browser is your operating system.
- cypress66 4y agoClick events, hover, etc have always existed (since js exists I'm pretty sure).
- paulryanrogers 4y agoRegardless of intent, today websites are often built as 'apps', making browsers more and more like your OS. JS is how that's usually implemented.
- shultays 4y agoIn forums you can select parts of someone's post and quote that part in your reply
- oarabbus_ 4y agoHumor me as someone without much web development experience - but what's to stop websites from displaying unclosable ads/popups? As in the "x" does nothing, or maybe doesn't appear at all?
- dreadlordbone 4y agoIt happens, but then people tend to not visit the site.
- dotancohen 4y agoBoth Pinterest and Quora have unclosable popups, as do many news websites.
- manfre 4y agoThere is a reason many articles and extensions exist to avoid those sites in search results.
- matheusmoreira 4y ago> what's to stop websites from displaying unclosable ads/popups? My uBlock Origin filters stop them with extreme prejudice.
- rasz 4y agoEnjoy them while you can, less than one year left.
- Latty 4y agoIf you just want to add text in, it is even easier, no JS required. just CSS: insert an element into your text that is positioned off-screen. When the user selects and copies, they'll get that text too.
- hulitu 4y agoA news website must not know that i selected text. A webpage shall display text. Keyboard input shall not be allowed except in text fields.
- beebeepka 4y agoI guess you must be really pissed off at something because you're not making any sense. Couple of things 1. How do you focus a text field without a keyboard? Mouse or touch only? No TAB, no up/down keys for scrolling, no escape, etc. 2. You can disable all non text content in a web page. This was always possible I can go on and on but what's the point?
- HWR_14 4y ago> what's to stop websites from detecting you've selected text, unselecting it, and copying the bad text in, and then reselecting it Disabling JavaScript.
- devmunchies 4y agoit'd be trivial to trick users to copy the wrong text with only CSS.
- HWR_14 4y agoWait, how?
- devmunchies 4y agoMake a layer that isn’t visible with “opacity: 0” that sits in front of the visible text. A user copies the invisible text instead. Or conversely, make the visible text “pointer-events: none” and it sits in front of the dangerous text.
- HWR_14 4y agoBoth of those make sense.
- rasz 4y agouserscript injecting this everywhere: window.addEventListener('copy', function copyintercept(e) { console.log(copyintercept.caller, 'copy action initiated'); e.stopImmediatePropagation(); }, true) document.addEventListener("contextmenu", bringBackDefault, true); function bringBackDefault(event) { event.returnValue = true; (typeof event.stopPropagation === 'function') && event.stopPropagation(); (typeof event.cancelBubble === 'function') && event.cancelBubble(); }