-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Faulty behaviour when browser access is not permitted. #77
Comments
Thanks a lot for such detailed explanation @wpp. We'll see what options we have to fix this. |
Found a possible approach - you can use document.execCommand('paste') on another node and see if it pasted:
|
Also worth noting, I believe this problem happens in both IE9 and IE10. IE11 appears to return the correct value from execCommand. |
Hey guys, I don't think we have a proper solution for this. For now, we'll describe this as a known bug on the wiki page. Thanks again for reporting @wpp and @jylertones for trying to help. |
//original code: //is OK??? |
The following error trap is working for me on IE11 inside my
|
因为之前可能已经有复制内容,会导致误判,所以我加了剪切板的内容对比,这样可能会比较完整: copyeSuccessFun: function(e) {
if (!ClipboardJS.isSupported()) {
// copyeErrorFun()
console.log('复制失败');
return
}
const clipboardData = window['clipboardData'];
if (clipboardData && clipboardData.getData) {
if (!clipboardData.getData('Text') || e.text != clipboardData.getData('Text')) {
// copyeErrorFun()
console.log('复制失败');
return;
}
}
console.log('复制成功');
} |
Hello,
This is a bit of an edge-case and might not have a proper solution. But since the project supports IE9+
and I'd qualify this as a "case where you'd like to show some user feedback".
I thought I'd be worth mentioning here.
Steps to reproduce:
AFAIK the root cause of the problem is that document.execCommand returns
true
even if it does not have permissions.Thanks for a great library with superb documentation.
Cheers.
The text was updated successfully, but these errors were encountered: