4 ms·
Afraid not. My suggestion, expanding on what they do, is to not to try to copy anything to the user's clipboard and instead highlight the content (I'd advise a
by eksith 13y ago
Afraid not.
My suggestion, expanding on what they do, is to not to try to copy anything to the user's clipboard and instead highlight the content (I'd advise against the hidden textarea too though). On mobile devices especially, highlighting is still a bit of a pain with large amounts of text.
http://stackoverflow.com/questions/11128130/select-text-in-javascript http://stackoverflow.com/questions/11128130/select-text-in-j...
Leave copying to the user. As an added benefit, you're not relying on browser hacks (IE only or otherwise) or flash.
- arsenerei 13y agoI'm curious why you'd advise against the hidden textarea.
- eksith 13y agoThis is entirely subjective so feel free to disregard. I don't believe it's necessarily a good idea to introduce elements that aren't user accessible. In this case, it's an actionable (command only) element that's inaccessible directly; the same as a tooltip or popup that hasn't shown itself yet. However, even in the case of a tooltip or popup, they will eventually show themselves to the user. A completely hidden anything IMO introduces a layer of obfuscation to what's actually happening to the DOM and on the page. It's a bit "hackish".
- arsenerei 13y agoI'm not sure if you mean user accessible in terms of User Accessibility or just a typical user having access. I think we're talking about UA, it wouldn't apply in this case, because they would be using a screen reader and using its features to find and copy the URI (rather than by hovering). In the case of a typical user, I think it does what they want, so it doesn't go against desire and ultimately enhances UX. It's definitely hackish, though. :)