Clipboard access using Javascript - sans Flash?

前端 未结 8 1299
你的背包
你的背包 2020-12-20 13:12

Is there a reliable way to access the client machine\'s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google D

8条回答
  •  Happy的楠姐
    2020-12-20 13:46

    You're looking for the execCommand function, at least the best I can tell. Here are some resources: Insert text in Javascript contenteditable div http://www.java2s.com/Code/JavaScriptReference/Javascript-Methods/execCommandisappliedto.htm

    Unfortunately, this runs into the same security loophole that Flash sealed in Flash 9. Since people were spamming the clipboard, the clipboard is now only accessible through direct user interaction, and honestly, it is better that way. And I'll wager that most browsers have similar (if not stricter policies).

提交回复
热议问题