You probably don't have the budget to make sure this works properly as you intend it everywhere it's accessible, and by introducing it you're actively making your site, and by extension my experience, less reliable and less predictable.
Excel ends up populating the plaintext as well as the HTML paste buffers. The plaintext buffer holds TSV output and the HTML buffer holds the full HTML. The HTML is the only way to distinguish between the two cells
|"foo|bar"|
and the single cell |"foo\tbar"| (using some CHAR magic in excel to generate the tab character)
my short spiel: http://blog.sheetjs.com/post/66908170192/the-magic-behind-ex...If you use keyboard short-cuts in your UI to copy into your app's memory but not the system clipboard then you have no way to know whether the data the user wants to paste was copied from your app or somewhere else. If you only use the system clipboard and inform the user that copy/pasting is done with right-click or key-combos and not the browser's "Edit" menu, you can handle copy-pasting predictably.
This was the most reliable method I could think of. Yes the browser's "Edit" menu is a problem and there's no way to get around that.
1. Disable Javascript. I browse with NoScript / Scriptsafe plugs installed, and disable JS by default. This defeats the demo in the article (I actually had to enable JS to break my copy/paste).
2. Use a console-mode browser and/or curl the source and grab what you want from it (though I've found sites which break console tools).
Better: enter domains which employ such tactics in your /etc/hosts file as 0.0.0.0.
As far as I can tell, blocking *.tynt.com cuts down on 99% of such gimmmicky tactics.
(I wonder why they're such a major provider; the paranoid in me wants to believe that they're using patents aggressively; the lazy person in me doesn't care.)
I wrote that post with the intention of using the solution in apps to copy/paste app data in plain text - eg. selecting multiple objects in a drawing app and copying them as a JSON string.
I guess NoScript/Ghostery/AdBlock Plus could be considered solutions to your problem.
Not necessarily a solution, as you can do it with css only. For example, people can put a 0-sized snippet at the end of the text, and then pad with some non-copyable text, so you select ABC, end up copying AB<something else>.
IIRC twitter does this for urls (think "http://oo.com…").
taye, I apologize if this isn't a constructive comment but this feature has annoyed me from time to time. Forbes.com just implemented it.
As I mentioned in another comment, I use NoScript to disable javascript so I wouldn't even notice that kind of thing. I agree that that is unnecessary and sort of abusive to users. I only intended on using this within web apps like a document editor etc.
As for trying it on the linked site, I have NoScript installed. Good luck trying to prevent me from copy-and-pasting now.
I right clicked on your "intercepting element," inspected with firebug, and deleted the input node. Then I could copy and paste as I desired. Firefox. 10 seconds?
My point is, we have many better things to spend our time on as developers than trying to control our user's access to the same information we're providing them. This not a reproach to taye, but to the bosses that ask us to build these worthless systems.
Bonus: you can get (on paste) and set (on cut and copy) data in multiple file formats. And obviously you can pre-process pasted data before injecting it in the system.
Try right-clicking here to see this workingShort of setting up a nameserver and going authoritative for the domain (I've done that, I'm feeling lazy), /etc/hosts doesn't take wildcards for hostnames.
But I say that because I'm a reasonable person. If you feel entitled to being able to copy everything as is, then I suppose you won't like it being altered.
But as a regular user, you just made me angry preventing me to copy and paste or adding obnoxious content (which I'm going to delete anyways).
So you traded a light barrier (if any) to unfair users for a huge annoyance to legitimate ones. Not very smart IMHO.
Come on. Appending a URL to the copied text doesn't break anyone's experience. It's a very tiny inconvenience at best.
As for them pre-judging any copy and paste as inherently unfair, most people on the Internet copy and steal things without giving credit. Appending a URL to a chunk of copied text is a way of nudging them to cite the material. As for fair-use folks, I see it as helpful. I always cite material I copy from elsewhere manually, but now the script does it for me. In either case, it's a win.
You're justifying their pre-judgment of people by pre-judging more people.
> I always cite material I copy from elsewhere manually, but now the script does it for me. In either case, it's a win.
Citing material by leaving the "\n\nRead more at http://something.somewhere/content.html" isn't a format I've ever seen anywhere, and seems like it would be incredibly annoying to parse.
No. It makes something that should be in muscle memory, which I shouldn't even have to think about, which I do countless times a day on other sites and with other tools exactly the way I expect, and forces me to stop and think about it. It breaks my concentration and breaks my flow. Sites which do this are broken. The site owners have reached out and purposefully chosen to make my tools misbehave. You don't get to tell me that's a "tiny inconvenience". Especially not when the reasoning behind it is so utterly asinine.
> most people on the Internet copy and steal things without giving credit.
I really, really hope you're trolling. Even if this bore the slightest, tiniest resemblance to reality, it wouldn't justify trying to break my tools. "There exists an infringing use case therefore all uses must be interfered with"? No. No. NO.