Rose
Rose

Reputation: 363

Clipboard.js not copying in Safari or Firefox

Clipboard.js is working well in Chrome (v50.0), but won't copy text on Firefox (v46.0).

clipboard.on('error', function(e){...}) is being thrown, and clipboardjs is supported on v41+, but the error provides no information beyond providing which button was clicked to trigger the copy.

Any ideas what could be happening here or what I could check/try?

Upvotes: 1

Views: 867

Answers (1)

MayK
MayK

Reputation: 1329

in the documentation it says that it's not supported in safari

Although copy/cut operations with execCommand aren't supported on Safari yet (including mobile), it gracefully degrades because Selection is supported.

That means you can show a tooltip saying Copied! when success event is called and Press Ctrl+C to copy when error event is called because the text is already selected.

For a live demonstration, open this site on Safari.

to get information about what was clicked check the trigger

clipboard.on('error', function(e) {
    console.error('Action:', e.action);
    console.error('Trigger:', e.trigger);
});

Upvotes: 1

Related Questions