Thursday, October 31, 2013

Bubbling copy/paste-friendly gunk up to smartphones in HTML5 applications.

When surfacing something that needs to be copy/paste-friendly from within the bowels of your application, why not use a textarea control as suggested here and make its copy automatically selected with JavaScript like this?

textarea.focus();
textarea.selectionStart = 0;
textarea.selectionEnd = textarea.value.length;

 
 

I hope this approach will prove iPhone-friendly. I'm not certain as of yet.

 
 

Addendum 11/1/2013: It didn't work. :(

1 comment: