1

I want to copy the system clipboard data in my extension; I am able to get the events for copy, cut and paste of my extension, bt I want to get the event when ever system clipboard changes.

How can I do this?

AstroCB
  • 12,337
  • 20
  • 57
  • 73
psraju
  • 23
  • 5
  • So you want to get the event when ever system clipboard changes is that you would like to detect the action(like Copy) when clipboard changes. If that's in the case, you can find the solution from this one: http://stackoverflow.com/questions/2870369/google-chrome-extensions-how-to-detect-copy-action-ctrl-c-and-edit-copy – Dayton Wang Mar 10 '15 at 21:46
  • @gui47 In extension page I am able to get the event. But if system clipboard updated outside the extension page I am not able to get event. Is there any possibility get the event? – psraju Mar 11 '15 at 11:54

1 Answers1

1

In general, you cannot. There is no event that indicates that SOMEWHERE in the system the clipboard was updated.

An imperfect solution would be to inject content scripts in all pages and listen to events in them. This will only work for copy/cut of the content of the pages themselves.

Community
  • 1
  • 1
Xan
  • 74,770
  • 16
  • 179
  • 206
  • Inside extension I am to get events. but outside the extension I want to get event. – psraju Mar 11 '15 at 11:58
  • It's not possible with Chrome only. You could try Native Host approach though. – Xan Mar 11 '15 at 12:06
  • if possible can you provide me some example on Native Host apporach. – psraju Mar 13 '15 at 06:00
  • I don't have a good example of how to listen to clipboard changes in some other language (you need to look it up), but if you do have a program ready (outside Chrome) that can, you can hook it up with Chrome using [Native Messaging](https://developer.chrome.com/extensions/nativeMessaging). Read that documentation to get an idea; sorry, I can't be more specific. – Xan Mar 13 '15 at 10:14