2015-12-21 121 views

回答

2

东西,你可以document.queryCommandSupported所需执行的命令

if (!(document.queryCommandSupported && document.queryCommandSupported('copy'))) { 
    $('.copy-btn').hide(); 
} 
+0

document.queryCommandSupported('copy')在chrome中总是为false! – coure2011

+0

@ coure2011请参阅[**已知错误**](https://developers.google.com/web/updates/2015/04/cut-and-copy-commands?hl=en#known-bugs)这不是_always_错误,例如测试'document.addEventListener('mouseup',function(){console.log(document.queryCommandSupported('copy'))})''会导致'true'在点击后登录 –

+0

此外,通过[this thread](https ://code.google.com/p/chromium/issues/detail?id = 476508)看起来像_Google Chrome's_实现将在v48.0.2541.0中修复这些错误 –