Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Copy in Firefox, Chrome and Safari
// We can't copy stuff in clipboard in Chrome, Safari and Firefox (Opera)
// Maybe one day this tickets will be resolved –
// But if they will, we still can only copy text to clipboard only during clipboard events
// We might get around this, it's not a production code, just...
var clipboard = function() {};
// If we have firebug installed
if ( console.notifyFirebug ) {
clipboard = function( text ) {
console.notifyFirebug( [ text ], "copy", "firebugExecuteCommand" );
// It also gives us event in Safari and Chrome for keyup in console
console.__defineSetter__( "_commandLineAPI", function( api ) {
clipboard = api.copy;
You can’t perform that action at this time.