[HN Gopher] The web's clipboard, and how it stores data of diffe...
       ___________________________________________________________________
        
       The web's clipboard, and how it stores data of different types
        
       Author : alexharri
       Score  : 153 points
       Date   : 2024-09-01 11:02 UTC (11 hours ago)
        
 (HTM) web link (alexharri.com)
 (TXT) w3m dump (alexharri.com)
        
       | cebert wrote:
       | Nice writeup. This explains why I have issues trying paste
       | with/without formatting on Firefox on my Mac in Google Docs. It's
       | interesting that Google is using a deprecated API to add their
       | own content type format to the clipboard.
        
         | throwaway48476 wrote:
         | At some point the Google web should be declared an official
         | fork of the web.
        
           | dumbo-octopus wrote:
           | If some bigwig has marked an API "depreciated", but hasn't
           | provided a viable alternative and the user experience suffers
           | when _user agents_ stop allowing their _users_ to invoke the
           | helpful functionality, the agents who do let their users do
           | what they want are not the issue.
        
             | kevingadd wrote:
             | I miss the flash player and unity player plugins too.
             | Remember how powerful activex was?
        
               | robocat wrote:
               | The main issue with powerful tools is that they get used
               | against you by threat actors.
               | 
               | Our society sets limits based on the most selfish. Our
               | computers get limitations based on the most effective
               | threat.
        
       | Terretta wrote:
       | Particularly good combination of scope (including differences
       | across systems and browsers) and depth (including both gotchas
       | and workarounds).
        
         | alexharri wrote:
         | Thanks! I've been trying to limit excessive detail and tangents
         | in my writing (my posts tend to be on the longer side). Great
         | to hear I managed to strike a good balance here.
        
       | 38 wrote:
       | rich text content should never be the default paste. just give me
       | the damn text I copied
        
         | Sayrus wrote:
         | For what it's worth, Ctrl/Cmd + Shift + V will paste the raw
         | clipboard even if a rich format is available.
        
           | zie wrote:
           | I just paste through a plain text editor(i.e. paste into a
           | plain text editor, verify and copy the bits I want, then
           | paste it in it's intended destination). I know not ideal, but
           | at least that way I can see and verify everything before
           | pasting it somewhere important. I'm sure there are some hacks
           | one can do with rich formats, that some people might try to
           | take advantage of.
        
             | gwervc wrote:
             | I do that within a new browser tab url bar, since the
             | shortcut is quite annoying to type.
        
               | pests wrote:
               | Sending your clipboard data to Google if you have
               | predictive type on
        
             | rzzzt wrote:
             | But do you press Ctrl/Cmd + C three times or more to make
             | sure it takes effect?
        
               | threecheese wrote:
               | Why are you watching me???
        
         | eyelidlessness wrote:
         | Software (OS, browser, native apps, web apps, ...) should make
         | it easier to use plain text for both read/write clipboard
         | operations. And probably should make it easier to prefer doing
         | that.
         | 
         | I know that's a lot more words to say a similar thing, but it
         | avoids two problems with how you put it:
         | 
         | 1. Not everyone will share your preference. (I'd hazard a guess
         | that it's a minority preference, albeit one I mostly share.)
         | 
         | 2. It's self-contradictory. The "damn text I copied" is not
         | just an array of characters: it often _includes formatting_ ;
         | it frequently interpolates other content that isn't even text
         | at all.
         | 
         | The latter is largely the basis for the former. You--and I,
         | mostly!--might be after that array of characters. But many many
         | people are after that richer content, and would be utterly
         | baffled by copying something rich only to get that array of
         | characters on the other side. And quite a lot of people would
         | have little recourse to get what they want.
         | 
         | This is why the multipart clipboard solution is a pretty good
         | compromise. It could be better! It could definitely accommodate
         | the preference for plain text. But it can only be better for
         | those of us with that preference, without regressing for the
         | much more common preference, by keeping the common preference
         | as default.
        
           | taejo wrote:
           | Part of the problem is a poor (or insufficiently DWIM)
           | implementation of rich text copy-paste. If I copy text that
           | has some parts bolded or italicised, that is indeed "the damn
           | text I copied". But the fact that the source website happens
           | to be 12pt blue Verdana should not override the fact that I'm
           | writing an email in 11pt black Arial.
           | 
           | In many cases I do not particularly care whether an email is
           | in 12pt blue Verdana or 11pt black Arial, I absolutely care
           | about there suddenly being a big blue word in the middle of
           | my otherwise-consistent paragraph.
        
         | dumbo-octopus wrote:
         | Sometimes I agree, but recently I was trying to copy all the
         | contents from one Quip to another and the system was entirely
         | unable to support pasting the same look&feel I copied. No, I
         | don't want my headings and links and code and lists and......
         | to all be given back as plain ASCII. Drove me bonkers.
        
         | nyanpasu64 wrote:
         | My problem with rich-text paste is that it transfers unwanted
         | presentational formatting, resulting in mismatched fonts,
         | sizes, and typography. I generally either want plain-text paste
         | or preserving semantic elements (like bold/italic emphasis,
         | links, and bullets).
         | 
         | More generally, when editing a document I want to be able to
         | view both formatted text and "escaped" contents (like "view
         | source"), and when copy-pasting or saving text, I want to be
         | able to convert formatted text into "escaped" text to diff, and
         | also paste text without misinterpreting asterisks and angle
         | brackets as formatting information (until I explicitly copy
         | text as source and paste as formatted).
        
       | cr125rider wrote:
       | This was awesome. Thanks!
       | 
       | A really nice deep enough dive into some of that nuance.
        
       | fitsumbelay wrote:
       | very illuminating and idea-provoking deep dive. thanks.
        
       | kfarr wrote:
       | My takeaway is the most reliable way to send custom app data over
       | clipboard is using data embedded in HTML a la figma. Bonus is
       | that method lets you define failure behavior via html message if
       | receiving app doesn't support
        
       | fitsumbelay wrote:
       | btw, what was the Chrome extension you were prompted about on
       | your macbook?
        
       | weejewel wrote:
       | Years ago when I was a student, and JavaScript could get a user's
       | clipboard without their consent, I made a website 'getpasted'
       | that automatically pasted and posted your clipboard to a public
       | database.
       | 
       | Needless to say, some people weren't happy about it. But it was a
       | nice project to create awareness that it was possible to read the
       | clipboard at any time.
        
       | threecheese wrote:
       | Excellent read, thank you. Just wanted to note that the author of
       | Pasteboard Manager[0], Sindre Sorhus, is also the maker of
       | Actions[1] shortcut library as well as other cool iPhone and Mac
       | apps. Not sure if he is on HN.                 - 0.
       | https://apps.apple.com/us/app/pasteboard-viewer/id1499215709
       | - 1. https://apps.apple.com/us/app/actions/id1586435171
        
       | djbusby wrote:
       | On the subject of getting "private" data from the browser.
       | 
       | Somehow my Bank webapp was able to 2FA prompt me on sign-in with
       | my hostname (aluminium). How did it get that? And when using
       | their site from mobile it's able to see the text with the 2FA
       | code and auto paste it in! Wow/How? Pixel+Chrome or Linux+Chrome.
        
         | echoangle wrote:
         | At least the 2FA Code probably is a Chrome feature, safari
         | displays 2FA SMS text codes as a autocomplete suggestion and I
         | could imagine that Chrome on Android just autofills it. For the
         | hostname, it's more difficult. Are you sure you never gave that
         | info to the bank as a username or similar? What Bank is this?
        
       ___________________________________________________________________
       (page generated 2024-09-01 23:00 UTC)