copy to clipboard - not working in FF,Chrome

I think the window.clipboardData is IE only. Accessing the clipboard is a security concern, and thus cannot be done easily in FF or Chrome.

Please see this thread: How do I copy to the clipboard in JavaScript?


The clipboard manipulation is not cross-browser. For cross-browser solution you need flash.

Look at this library https://github.com/jonrohan/ZeroClipboard

You can use ZeroClipboard like this:

<button id="my-button" data-clipboard-text="Copy me!">Copy to Clipboard</button>
<script>
    var clip = new ZeroClipboard(document.getElementById('my-button'));
</script>

When you click on the button the text Copy me! will be put into the clipboard.

For further instructions check the library's API https://github.com/jonrohan/ZeroClipboard/blob/master/docs/instructions.md