News for hackers. Stuff that matters.
Re:JavaScript modifying cut and paste can sometimes be a goo... by housemusicfan on Sunday June 18, 2023 @02:18PM (#36382795)
Allowing JavaScript to modify the clipboard contents is cancerous behavior and the developers that enabled this functionality should have their heads examined.

Not once have I seen this function used in a non-abusive manner. More often then not it's either used to inject advertisements or copyright notices in the content copied to the clipboard.

When you issue a copy command, what should appear on the clipboard is EXACTLY what is selected. I wish browser makers would stop adding useless new features and get down to brass tacks. It's 2023 and sites can still detect incognito mode which defeats the purpose.

Re:JavaScript modifying cut and paste can sometimes be a goo... by hfkwer on Sunday June 18, 2023 @02:27PM (#36382895)
Why such hyperbole? Cancerous? Heads examined? That's ridiculous. Wikipedia allows you to copy math expressions as MathML rather than a rendered SVG. Is that "cancerous behavior"?!
Re:JavaScript modifying cut and paste can sometimes be a goo... by housemusicfan on Sunday June 18, 2023 @02:48PM (#36383119)
I'm sure grenade launchers are great for hunting deer and other game but there's a reason they don't allow just anyone to buy one, despite there being an occasional positive use case.
Re:JavaScript modifying cut and paste can sometimes be a goo... by 8note on Sunday June 18, 2023 @05:57PM (#36384930)
I don't really understand what response is here.

Like still, how is cancer a relevant metaphor? What's the cancerous cell that is avoiding typical cell death and reproducing unexpectedly? How is it taking resources from the group of cells that would usually use them?

Re:JavaScript modifying cut and paste can sometimes be a goo... by blendergeek on Sunday June 18, 2023 @06:05PM (#36385011)
Grenade launchers would actually be a very poor tool for hunting deer.

Most deer hunters are looking to either take home a trophy or meat (or both). The use of a grenade to kill the deer would lead to the destruction of both meat and trophy.

While some hunters are hunting for sport and may enjoy the challenge over the trophy or the meat, these tend select an underpowered weapon (such as a bow and arrow) rather than an overpowered weapon (such as a grenade).

Re:JavaScript modifying cut and paste can sometimes be a goo... by poniko on Sunday June 18, 2023 @02:21PM (#36382831)
In pixlr we copy and paste bitmap data and layers etc .. a feature that most users love .. and are pissed by the browsers that don't enable it. The problem is more about how the rights to access features is managed in browsers, it needs a total rewrite.
Re:JavaScript modifying cut and paste can sometimes be a goo... by pests on Sunday June 18, 2023 @03:02PM (#36383244)
You've never seen the little "copy" button next to important information on websites? That is a non-abusive implementation.
Re:JavaScript modifying cut and paste can sometimes be a goo... by bkuehl on Sunday June 18, 2023 @09:05PM (#36386140)
Thank you! I had to scroll too far down to see this. There are many useful implementations. Copying code, copying a long number, etc.

Just make it clear what is going to happen when you click that button/icon.

Re:JavaScript modifying cut and paste can sometimes be a goo... by antoniojtorres on Sunday June 18, 2023 @04:58PM (#36384386)
I was thinking about this the other day in relation to how iOS shows you this obtrusive confirmation dialogue if you’re pasting in or out of certain apps like firefox. At first I was wondering if it was another one of their not so subtle anti-competitive moves, and then I read that the initial need for this was apps swiping information from user’s clipboard and other types of abuses like that.

It baffles me why that was ever made accessible to apps or programs.

Re:JavaScript modifying cut and paste can sometimes be a goo... by jjcm on Sunday June 18, 2023 @05:58PM (#36384932)
> When you issue a copy command, what should appear on the clipboard is EXACTLY what is selected.

I disagree. There are plenty of situations where you would want to copy something that isn't the direct object you're selecting.

Some simple examples:

1. Copying an object that uses a non-human readable format for an underlying data structure. If I'm pasting this into another application, I likely don't want to paste the bytecode or a JSON representation, but rather a text-readable representation or an image representation of that object.

2. Copying latex syntax when selecting mathematical equations rather than copying a SVG.

3. Copying or omitting rich text decorators (i.e. markdown decorators)

4. Copying an email address rather than a human-readable name if selecting a user-pill in an email "to" field.

The API isn't the issue. There are a ton of situations where using it improves the user experience. It's growth-marketing tactics that are the issue.