How to remove the text from the clipboard using JS or other means?

    4 answers 4

    Javascript will not allow you to do this. This is, after all, unsafe for the user, otherwise any web page will be able to “pry” behind you. The same is true for pure HTML (there are not too many expressive means for this).

    Can help the old version of Flash. Although, for a fresh FlashPlayer, it is forbidden to read the clipboard without explicit user action:

    User-initiated action requirements in Flash Player 10 [ archive ] :

    ... reading from the Clipboard using the new ActionScript 3.0 API, Clipboard.generalClipboard.getData can be used.

    Access to the clipboard can be obtained from a Java applet , but I have not tried it - perhaps the user will have to explicitly allow this applet to run.

    • one
      In general, I concluded: NO. SIMILAR. - igolka97
    • one
      @ igolka97: Yeah: (And what exactly do you want to achieve globally? What functionality? Tell me, maybe something will come up together. PS: Protection is designed so that web pages do not steal credit card numbers and passwords from the clipboard. Or photos :)) - VladD

    In internet explorer for this purpose there is a clipboardData . In firefox there is a class with which you can work with the buffer.

    You should also pay attention to the library - ZeroClipboard .

    • The Firefox @mozilla.org/widget/clipboardhelper component is available only to add-ons. In a fresh IE, I hope the hole was covered. The same restrictions apply to ZeroClipboard as to the entire Flash: read access is possible only in the context of a paste event. - VladD

    Clipboard API and events .

    As it did, the implementation of the stand support textarea. There was a task to copy data from Excel to the extJS table, it even worked. If I find the source I will lay out the project is already old but in the archives should be.

    • I really hope))) - igolka97
     pastEventHandler = function (e) { e.originalEvent.clipboardData.getData('text'); // только в e.originalEvent }