Read the client clipboard with jQuery?

2019-02-18 20:11发布

问题:

Is it possible to get/read the clipboard of a client with jQuery?

(I need get the information of a spread sheet and paste this information in a jqGrid web grid...)

回答1:

Well according to this similar SO question it cannot be done with just JavaScript. Which is good, because it would be a major security risk. You need a small flash object to get the functionality you want.

In any way, this is a duplicate question.



回答2:

Does DataDrop – Drag Grid Data in From a Spreadsheet help? It would be drag & drop instead of reading the clipboard, but reading the clipboard is difficult to impossible.



回答3:

I did a workaround to accomplish the request. Basically I included a TextBox object into my Web Form with the legend "Paste your information [Here]. Using CTRL + V". Then, I read the event pressKey with jQuery (reading CTRL + V combination), then I can read the clipboard data in the TextBox.