TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Don't touch my clipboard

718 pointsby otrasabout 5 years ago

43 comments

stefco_about 5 years ago
It&#x27;s not just a browser thing. Apple Books does this with their e-books, which is <i>infuriating</i> if you&#x27;re working with a coding book and just want to copy-paste stuff into your editor&#x2F;terminal. You get something like:<p><pre><code> “ghci&gt; putStrLn (pretty 10 value)” Excerpt From: Bryan O’Sullivan, John Goerzen, and Donald Bruce Stewart. “Real World Haskell.” Apple Books. </code></pre> When you only copied:<p><pre><code> ghci&gt; putStrLn (pretty 10 value) </code></pre> Note that the quotes around your actual selection aren&#x27;t even the ASCII quote character; you get horrid unicode quotes that are easy to miss if you&#x27;re just trying to run a bit of code in your REPL. This isn&#x27;t even a DRM ebook, so it&#x27;s not like Apple is being compelled by contract to insert a citation. It&#x27;s awful, user-hostile behavior that removes one of the main advantages of digital-vs-hardcopy coding books (copy&#x2F;paste), and AFAIK there&#x27;s no config that lets you disable it.
评论 #22353131 未加载
评论 #22355754 未加载
评论 #22353187 未加载
评论 #22355322 未加载
评论 #22361283 未加载
评论 #22353775 未加载
评论 #22353570 未加载
评论 #22372389 未加载
评论 #22353475 未加载
评论 #22354713 未加载
评论 #22354228 未加载
评论 #22355613 未加载
评论 #22353218 未加载
评论 #22353332 未加载
smichel17about 5 years ago
The wrongest thing about this, from my perspective, is that my browser fires off a js &#x27;copy&#x27; event when I press control-c. There are times when I&#x27;ve found it helpful that a browser can copy text to my clipboard when I click a button, but I can&#x27;t think of a single time when I want a site to react to my attempt to copy text off if it.<p>Is there any way to configure my user agent (Firefox) not to do this? A hack is ok.
评论 #22353419 未加载
评论 #22353026 未加载
评论 #22353488 未加载
评论 #22353397 未加载
评论 #22356697 未加载
评论 #22352929 未加载
评论 #22353063 未加载
评论 #22354596 未加载
评论 #22356234 未加载
评论 #22357679 未加载
评论 #22355262 未加载
评论 #22353198 未加载
评论 #22361461 未加载
评论 #22353005 未加载
评论 #22356742 未加载
评论 #22354570 未加载
actionowlabout 5 years ago
The last sentence of the article is the absolute best:<p>&gt; Ironically, a little reverse searching reveals that this code was copied verbatim without attribution from this StackOverflow post (see “Manipulating the selection” from the top answer). Maybe copy&#x2F;paste isn’t so bad?
cutchinabout 5 years ago
This happened to me recently and it was pretty embarassing - I copied a two paragraph snippet from a psychology paper and the website put an ad for CBD oil in my clipboard above the paragraphs.<p>The segment I copied was just long enough that it overflowed my chat window so I had no idea the insertion was even there and I sent it as-is.<p>The recipient called me about two minutes later and said &quot;hey, I think you&#x27;ve been hacked - you just sent me a CBD oil advertisement.&quot;<p>So yeah, I&#x27;d love to see user agents address this. If I push a copy button (like github&#x27;s clone repo button) then fine, I&#x27;m at the mercy of their javascript. But if I copy via ctrl-C or a right click menu, it should not not let the page interfere.
评论 #22353464 未加载
评论 #22355271 未加载
dansoabout 5 years ago
This hijacking “feature” that’s been a part of news and other proprietary content sites for more than a decade now:<p><a href="https:&#x2F;&#x2F;moz.com&#x2F;ugc&#x2F;copymagicpaste-a-script-and-easytouseguide-to-customize-the-copyevent-on-your-website" rel="nofollow">https:&#x2F;&#x2F;moz.com&#x2F;ugc&#x2F;copymagicpaste-a-script-and-easytousegui...</a><p>Anecdotally speaking, I’ve seen it a lot less these days; mostly, I see it when copy-pasting from my Kindle app. I’ve rarely ever seen it for a site this general-purpose (and trivial) though
评论 #22352855 未加载
评论 #22352829 未加载
jiggawattsabout 5 years ago
I can read &amp; write a language that I don&#x27;t have a keyboard for (I use a standard US 101 key layout), so I work around this by cut &amp; pasting single characters around to fix up the missing accent characters. Usually even a partially fixed word is enough for the spell checker to kick in and correct the rest, making this surprisingly fast.<p>The thing that annoyed me recently is that if I cut &amp; paste a single character in Google Mail, it&#x27;ll &quot;helpfully&quot; surround it with spaces when pasted. Other applications like Firefox or MS Word don&#x27;t have this behaviour.<p>I just tested it, and the GMail behaviour is wonderfully inconsistent:<p>Copying from GMail to to plain text (e.g.: a text editor) will result in a single character.<p>Copying from plain text into GMail will result in no superfluous spaces.<p>Copying from GMail to GMail or to any &quot;rich text&quot; editor will add the extra spaces.<p>So basically I&#x27;m copying plain-text, but GMail is abusing rich-text formatting to add &quot;magic&quot; behaviour someone at Google assumed is beneficial, but is just confusing and arbitrary.<p>PS: Similarly, GMail&#x27;s spell checker now &quot;fights&quot; with the Firefox spellchecker and the result is that neither wins and obvious typos aren&#x27;t resolved unless I turn checking off and back on a couple of times.
评论 #22354439 未加载
评论 #22353721 未加载
评论 #22353860 未加载
sleaveyabout 5 years ago
Furthermore don&#x27;t touch my ability to paste into web forms. Some banks do this, and I have no idea why (some incredibly misguided idea of security?). I disabled the ability for websites to disable pasting using Firefox&#x27;s about:config, but 99.9% of users won&#x27;t know they can do this.
评论 #22356920 未加载
评论 #22355873 未加载
skrebbelabout 5 years ago
Just want to share that there&#x27;s also good reasons for employing this technique.<p>Eg if you select text in Slack that has emojis or formatting, it tries to put plain-text into the clipboard that would <i>produce</i> said emojis and formatting when pasted back into Slack. This is great, and every chat app does does formatted stuff should do this.<p>I&#x27;d hate it if browser vendors would attempt to block this and as a result, break that kind of functionality too.
评论 #22354377 未加载
评论 #22355897 未加载
Nicksilabout 5 years ago
I agree and share the frustration.<p>A stock Apple application &quot;Books&quot; does something similar as well. When copying text -- using keyboard shortcut or the context menu rendered as soon as you lift your mouse (another tragedy) -- your clipboard will look something like the following (2 lines):<p>“&lt;what you actually wanted to copy&gt;”<p>Excerpt From: &lt;Author&gt;. “&lt;Title&gt;.” Apple Books.<p>That gets written to your clipboard; quotes and everything.
评论 #22372867 未加载
评论 #22353094 未加载
crazygringoabout 5 years ago
Seriously... I want to know the business&#x2F;legal logic behind adding copyright messages to the clipboard when copying. This has happened for a long time with news sites, Apple Books, etc.<p><i>No user ever</i> has <i>ever</i> wanted that.<p>So what lawyers, where, ever demanded it, and why? Short snippets fall under fair use <i>anyways</i>... and even if it didn&#x27;t such a message doesn&#x27;t prevent anything (you just delete it after pasting)... and it you were oblivious to how copyrights worked before, this isn&#x27;t going to teach you.<p>So it&#x27;s UX annoyance but <i>why?</i> Not only does it <i>not</i> provide an obvious legal benefit to any party, I don&#x27;t even see how it&#x27;s legally covering anyone&#x27;s ass? Like, I know how under trademark law companies have to warn people against using their trademark generically or else they can lose it -- so as dumb as it is to get an e-mail from Adobe asking you not to use &quot;Photoshop&quot; as a verb in your press release, I get it. But copyright... <i>doesn&#x27;t work like that.</i><p>So how&#x2F;why did this become a thing? I just don&#x27;t understand the legal rationale here.
评论 #22353502 未加载
评论 #22359731 未加载
评论 #22360265 未加载
brigandishabout 5 years ago
This isn&#x27;t just the web, there&#x27;s a fundamental leakiness to the Mac&#x27;s clipboard. I was horrified to realise that apps were being alerted to what was on the clipboard when I copied a a public key from some website and MacGPG (or whichever GPG app it was, they change) popped its head up and told me (something like) &quot;Hi, you&#x27;ve copied a public key, would you like to save it in your keyring?&quot;<p>Does this mean that any currently running app (or maybe not even currently running, perhaps there&#x27;s an event system) can see my clipboard?<p>My feeling about this is unprintable.<p>I started planning a clipboard app that doesn&#x27;t allow this but I&#x27;m busy and I&#x27;d prefer this wasn&#x27;t something I need to fix in the first place.
评论 #22353354 未加载
评论 #22353438 未加载
prestemonabout 5 years ago
Most importantly, <a href="https:&#x2F;&#x2F;emdash.fan&#x2F;" rel="nofollow">https:&#x2F;&#x2F;emdash.fan&#x2F;</a> is the best emdash site on the internet.
评论 #22353016 未加载
DavidVoidabout 5 years ago
On a related note, I find it interesting how modern US-ANSI layout keyboards (even the International version [1]) still has such a limited set of characters.<p>We have ¼, ½, and ¾, but not en (–) and em (—) dashes; and I get that (&#x27;) and (&quot;) are leftovers from typewriters and ASCII, but wouldn&#x27;t it be nice to have proper 6-9 (‘…’) and 66-99 (“…”) quotation marks?<p>Then again, you often see Europeans online misusing acute (´) and grave ( `) accents as apostrophes (writing don´t or don`t, instead of don&#x27;t or don’t). So perhaps the availability of more similar looking keys would just lead to even more misuse?<p>[1]: <a href="https:&#x2F;&#x2F;upload.wikimedia.org&#x2F;wikipedia&#x2F;commons&#x2F;2&#x2F;22&#x2F;KB_US-International.svg" rel="nofollow">https:&#x2F;&#x2F;upload.wikimedia.org&#x2F;wikipedia&#x2F;commons&#x2F;2&#x2F;22&#x2F;KB_US-In...</a>
评论 #22358081 未加载
adtacabout 5 years ago
I chuckled when I saw the copyright. What exactly are they copyrighting? Lorem ipsum? The bloody emdash itself?<p>Even I exercised more caution when I was 12 and learning HTML, arbitrarily applying copyright to things I didn&#x27;t own.
SanchoPandaabout 5 years ago
My favorite demo on this subject:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;dxa4481&#x2F;Pastejacking" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dxa4481&#x2F;Pastejacking</a>
评论 #22352942 未加载
userbinatorabout 5 years ago
IE (but not Edge, not surprisingly...) actually has a built-in feature which was probably specifically designed to target such things:<p><a href="https:&#x2F;&#x2F;i.stack.imgur.com&#x2F;855az.png" rel="nofollow">https:&#x2F;&#x2F;i.stack.imgur.com&#x2F;855az.png</a><p>Selecting &quot;prompt&quot; will result in this:<p><a href="https:&#x2F;&#x2F;i.stack.imgur.com&#x2F;jvDUh.png" rel="nofollow">https:&#x2F;&#x2F;i.stack.imgur.com&#x2F;jvDUh.png</a><p>I set it to Prompt for trusted sites, and Disabled for all others.
评论 #22356463 未加载
jawnsabout 5 years ago
There used to be a time when we could hope that browsers would put users first and disable dark patterns like these.<p>Now, there are so many advertisers that use Tynt and related services to muck with copy&#x2F;paste that it wouldn&#x27;t surprise me if the major browsers are incentivized to leave this alone and let users suffer.
评论 #22352871 未加载
评论 #22353024 未加载
评论 #22352853 未加载
112about 5 years ago
It&#x27;s fine. This is just stupidity dressed as on-purpose bad UX. Yes, I consider whoever makes that decision (&quot;Yeah, we should totally make it not do what the user wanted it to do!&quot;) utterly stupid, and a sad presence in the gene pool.<p>There are file management apps, graphic design apps (figma), etc., that use both the clipboard and the &lt;c-c&gt; &#x2F; &lt;c-p&gt; binds to work. Neither blocking the bind of &lt;c-c&gt; events, nor of the clipboard are going to happen.<p>We all have different needs and different pains. Sure, around here, we care about user experience, privacy, performance and optimizations, but let&#x27;s not forget that we&#x27;re in a bubble. The regular less-powered users are just as important as us, and their needs may outweight ours.<p>I wish there was truly open browser that was not crap, there isn&#x27;t. I wish better privacy controls were available out-of-the box. I wish there could be a <i>feature matrix backed by a default profile</i> so that I can only give access to the clipboard &#x2F; other APIs manually, but with a prompt on access attempt. I wish so much.<p>If I don&#x27;t like my job runner, or my window manager, or even my password manager, I can go ahead and try with at least moderate success to make my own. Browsers are made by large groups of competent (most of them) polyglots, that work countless hours, willing to drill through the shit that has accumulated over the years into what we call the web. I don&#x27;t have what&#x27;s required to make my own browser.
评论 #22362443 未加载
TheRealDunkirkabout 5 years ago
There&#x27;s a Safari extension called StopTheMadness that prevents this sort of thing. I just tested it on this page, and it does indeed stop this particular nonsense.
thought_alarmabout 5 years ago
I&#x27;ve been using a simple Javascript whitelist&#x2F;blocker for the last 4 years or so (a dead-simple Safari content blocker for iOS and Mac I wrote myself; syncs over iCloud just to give me something to do) and I honestly don&#x27;t know how anyone can stand the wide-open web without something similar.<p>Using the web with free Javascript privileges is an utterly appalling experience. I can&#x27;t stand it for more than 5 seconds.
评论 #22353032 未加载
评论 #22353078 未加载
hotenabout 5 years ago
I had the exact same reaction to this site a few days ago.<p><a href="https:&#x2F;&#x2F;twitter.com&#x2F;cjamcl&#x2F;status&#x2F;1228501692682924032" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;cjamcl&#x2F;status&#x2F;1228501692682924032</a>
bmn__about 5 years ago
Related:<p><a href="http:&#x2F;&#x2F;kb.mozillazine.org&#x2F;Granting_JavaScript_access_to_the_clipboard" rel="nofollow">http:&#x2F;&#x2F;kb.mozillazine.org&#x2F;Granting_JavaScript_access_to_the_...</a><p><a href="https:&#x2F;&#x2F;addons.mozilla.org&#x2F;firefox&#x2F;addon&#x2F;don-t-fuck-with-paste&#x2F;" rel="nofollow">https:&#x2F;&#x2F;addons.mozilla.org&#x2F;firefox&#x2F;addon&#x2F;don-t-fuck-with-pas...</a>
nomadratabout 5 years ago
I used to work for a big ad-tech company(the company is sold and closed now). I was a guy who developed a tool with this functionality. As a publisher, you can add a text with a link(plus tracking code) to every copied peace of text from your webpage. Something like: &quot;Read more at: <a href="https:&#x2F;&#x2F;example.com&#x2F;my-article&#x2F;#&lt;tracking_code&gt;&quot;" rel="nofollow">https:&#x2F;&#x2F;example.com&#x2F;my-article&#x2F;#&lt;tracking_code&gt;&quot;</a><p>It&#x27;s not about copyright. As a website owner, you can disable this behavior, but by default, it was enabled. The main purpose of this functionality was to track shares(for example if you copy text and send it to your friend in skype). As i remember it was one of the most popular &amp; important features in the whole toolkit.<p>In a nutshell, it&#x27;s about 200 lines of battle-tested javascript-code that worked perfectly fine in almost any browser(dunno about now it was around 3 years ago).<p>Personally, i hate this behavior.
ernie24about 5 years ago
Credit where credit&#x27;s due, the mentioned website (The Punctuation Guide) works very well with JS disabled, and the problem with text copying is gone. I use <a href="https:&#x2F;&#x2F;github.com&#x2F;meetDeveloper&#x2F;Quick-JS-Switcher" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;meetDeveloper&#x2F;Quick-JS-Switcher</a>
slimsagabout 5 years ago
Really, the web just gets more and more vile towards users.<p>Sure, highly technical folk are capable of working around this all -- but the vast majority of people do not have a browser that is _working for them_:<p>- You have little to no control over what content you are seeing. Instead, it is chosen for you.<p>- A large number of videos (not even including movies and shows) are geographically blocked. You cannot access them.<p>- Developers are actively trying to prevent: Saving images[1][2][3], selecting text[4][5], browsing on a mobile phone[6][7], and a whole slew of other normal user actions I don&#x27;t care to cite: preventing users from going back, manipulating their browser history, asking for notification and geolocation permissions, displaying full-screen modals that block content access, scroll-jacking, click-jacking, and more.<p>But don&#x27;t worry! It&#x27;s not all doom and gloom, websites like Reddit, Instagram, Facebook, banks, and more are heavily pushing their users away from the web to mobile applications where you have ZERO choice.<p>And we&#x27;re going to maintain this backwards-compatible stack of completely volatile pieces of anti-patterns until that migration to &quot;apps&quot; is complete, and you can no longer distinguish between the app on your phone monitoring everything you do or the site running 5 different layers of VMs and doing the same -- albeit a bit slower.<p>[1] <a href="https:&#x2F;&#x2F;security.stackexchange.com&#x2F;questions&#x2F;122922&#x2F;discouraging-users-from-copying-images-off-a-website" rel="nofollow">https:&#x2F;&#x2F;security.stackexchange.com&#x2F;questions&#x2F;122922&#x2F;discoura...</a><p>[2] <a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;21110130&#x2F;protect-image-download&#x2F;48855148" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;21110130&#x2F;protect-image-d...</a><p>[3] <a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;35897974&#x2F;how-to-prevent-image-from-copying" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;35897974&#x2F;how-to-prevent-...</a><p>[4] <a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;16805684&#x2F;javascript-disable-text-select" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;16805684&#x2F;javascript-disa...</a><p>[5] <a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;8365272&#x2F;disable-copying-on-a-website" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;8365272&#x2F;disable-copying-...</a><p>[6] <a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;10177456&#x2F;how-to-disable-access-to-website-for-mobile" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;10177456&#x2F;how-to-disable-...</a><p>[7] <a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;22618724&#x2F;how-to-disable-my-website-from-being-viewed-on-mobile-devices" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;22618724&#x2F;how-to-disable-...</a>
评论 #22353244 未加载
评论 #22353163 未加载
评论 #22352971 未加载
superkuhabout 5 years ago
You&#x27;re giving sites permission to do this when you browse the web with browser that automatically executes whatever code it is sent. They&#x27;re not forcing you, you&#x27;re going there and you&#x27;re asking for it and doing it yourself.<p>There&#x27;s an easy solution. Stop. Don&#x27;t run JS by default.
评论 #22353863 未加载
评论 #22353936 未加载
timzamanabout 5 years ago
The author sadly didn&#x27;t touch on e.g. zero-width spaces (<a href="https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;Zero-width_space" rel="nofollow">https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;Zero-width_space</a>) to fingerprint anything copy pasted.
pgtabout 5 years ago
Upvoted for the emdash (—) shortcut: Shift+Option+Minus
dawnerdabout 5 years ago
I had to implement an in-house version of this way back on eHow before it was pretty easy. Cross browser issues made it pretty tricky - which is probably why a couple companies that just did this spawned from it.<p>It&#x27;s all so silly and doesn&#x27;t increase site visits in any meaningful way.<p>Sidenote: I&#x27;m glad javascript in browsers is a lot more standard so you don&#x27;t have to get stupidly hacky.
the_d00dabout 5 years ago
Just wait until they place an ad in your clipboard
评论 #22354104 未加载
onion-soupabout 5 years ago
What&#x27;s with ultra-grey font colors? It&#x27;s not 2010 anymore, give your text some contrast ffs, you are killing my eyes
评论 #22356044 未加载
zzo38computerabout 5 years ago
I mostly do not enable document scripts. But, does any browser have a setting to disable the ability for document scripts to affect selections? (They also mention smooth scrolling. I don&#x27;t like that either, nor replacing standard widgets with their own or adding additional worthless animations.)
flargabout 5 years ago
There&#x27;s an extension that stops this and it&#x27;s called Don&#x27;t F<i></i>k with Paste
abrax3141about 5 years ago
I wish clipboards worked like emacs yank buffers. Then you wouldn&#x27;t have this problem.
mopsiabout 5 years ago
It&#x27;s not just an annoyance. Think of copying shell commands...
hoangbkitabout 5 years ago
Awesome post! many times i copied some stuff and they appended links and advertising contents into it ^^ so annoying, especially in those listing sites like quotes or similar.
kebmanabout 5 years ago
Hindering someone from grabbing an emdash with copy-scripts is pretty petty. Edit: Anyway, reminds me when I used to troll my buddies with the ANSI.SYS hack.
mangatmodiabout 5 years ago
There is a special place in my hatebook for websites which disable copy, this website just earned the top place
generalpassabout 5 years ago
Firefox makes life easier:<p><pre><code> Ctrl+Alt+R </code></pre> Also, uMatrix with js disabled by default works well, too.
eitlandabout 5 years ago
This is bad UX if nothing else.<p>For an example of what I think wad good UX: In Windows, it used to be that pasting into a text editor would give you the original text while pasting into OneNote would magically give you the text with a link back to the source below.<p>I used to love that and for what I know it still works, I just don&#x27;t use Windows and OneNote that much anymore.
thanhkittabout 5 years ago
“ghci&gt; putStrLn (pretty 10 value)”<p><pre><code> Excerpt From: Bryan O’Sullivan,</code></pre>
hartatorabout 5 years ago
Also special place in hell for pages that disables paste on their inputs.
brobot182about 5 years ago
Is there a chrome plugin that prevents this?
评论 #22353199 未加载
评论 #22353017 未加载
评论 #22353410 未加载
评论 #22353111 未加载
评论 #22352986 未加载
评论 #22353174 未加载