Reputation: 42454
Using clipboard plugin http://zenorocha.github.io/clipboard.js/ Can I know programmatically whether this plugin is supported or not on the running browser? The idea is I want to hide the 'copy to clipboard' button if the plugin is not supported. Something like
if(clipboard is not supported) {
$('.copy-btn').hide();
}
Upvotes: 1
Views: 1081
Reputation: 3586
You can use document.queryCommandSupported
but there are some known bugs. That's why I recommend using this polyfill.
Upvotes: 1
Reputation: 3802
You have to check whether the browser version is greater than or equal to those mentioned in the "Browser Support" section.
https://github.com/zenorocha/clipboard.js#browser-support
Upvotes: 0
Reputation: 66334
You can document.queryCommandSupported
the required underlying command
if (!(document.queryCommandSupported && document.queryCommandSupported('copy'))) {
$('.copy-btn').hide();
}
Upvotes: 2