Notice
Recent Posts
Recent Comments
Link
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Archives
Today
Total
관리 메뉴

miako

[script] copy to clipboard 본문

work

[script] copy to clipboard

MiaKo 2016. 7. 27. 10:24

http://www.javascriptkit.com/javatutors/copytoclipboard.shtml


https://github.com/ryanpcmcquen/simpleJsCopy


https://clipboardjs.com/

clipboard.js-master.zip


ios safari problem

http://stackoverflow.com/questions/34045777/copy-to-clipboard-using-javascript-in-ios


iOS Safari there are some restrictions (which actually are security measures) to the Clipboard API

It fires copy events only on a valid selection and cut and paste only in focused editable fields.

It only supports OS clipboard reading/writing via shortcut keys, not through document.execCommand(). Note that "shorcut key" means some clickable (e.g. copy/paste action menu or custom iOS keyboard shortcut) or physical key (e.g. connected bluetooth keyboard).

It doesn't support the ClipboardEvent constructor.

So (at least as of now) it's not possible to programmatically copy some text/value in the clipboard on an iOS device using Javascript. Only the user can decide whether to copy something.


iOS는 보안 문제로 Clipboard API를 지원하지 않습니다.

오직 유저의 물리적 엑션을 통해 iOS에서 제공하는 메뉴를 사용해서만 가능하며 프로그램이나 스크립트로는 불가능합니다.


In this case, it seems that the user must first select the content to copy.

ios safari의 경우엔 유저가 복사할 컨텐츠를 스스로 선택하는 단계가 반드시 필요하다.



use document.execCommand('copy') in IOS safari

From my test. IOS8.0 Safari can copy as well, but IOS7,9 or other IOS8 version can't!



참고)


- Playing with the clipboard in iOS safari – Ryan Seddon 

https://www.thecssninja.com/javascript/ios-clipboard


- 클립보드API 지원 브라우저

http://caniuse.com/#feat=clipboard


- Clipboard API editor spec

https://w3c.github.io/clipboard-apis/


- great resource

http://help.dottoro.com/larpvnhw.php


'work' 카테고리의 다른 글

[plugin] jstree  (0) 2016.07.13
[program] Sublime Text  (0) 2016.07.12
[program] TortoiseSVN  (0) 2016.07.12
[css] Truly Fluid Typography With vh And vw Units  (0) 2016.06.30
[work] Mobile  (0) 2016.06.28