Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Intermittent silent copy failures in IE #640

Open
peteallen opened this issue Mar 18, 2016 · 1 comment
Open

Intermittent silent copy failures in IE #640

peteallen opened this issue Mar 18, 2016 · 1 comment

Comments

@peteallen
Copy link

We have observed intermittent copy failures in our application when using IE versions 9, 10 and 11. The problem is most prevalent in IE9, occurring roughly 1 in 20 copies and least frequently in IE 11 (it can be very difficult to reproduce in IE 11).

I created a simple test case which reproduces the problem. To see the problem, create the following files and then open index.html in IE9 (tested over a remote connection, not localhost or file system). Click the Copy button, then compare the contents of the clipboard to the message displayed on the screen. Occasionally, the clipboard will not be updated and will contain the message from the previous copy.

I'm also displaying the aftercopy event object, which shows that the copy status was "success" and has an empty error array.

index.html:

<html>
 <head>
   <meta http-equiv="X-UA-Compatible" content="IE=Edge">
 </head>
  <body>
    <button id="copy-button">Copy</button>
    <div id="copiedText"></div>
    <div id="result"></div>
    <script src="ZeroClipboard.js"></script>
    <script src="main.js"></script>
  </body>
</html>

main.js:

var client = new ZeroClipboard(document.getElementById("copy-button"));
var x = 1;
var copyText;

client.on('ready', function(event) {
    client.on('copy', function(event) {
      copyText = 'Copy number ' + x++;
      event.clipboardData.setData('text/plain', copyText);
    });

    client.on('aftercopy', function (event) {
        var element = document.getElementById('copiedText');
        if (event.errors && event.errors.length > 0) {
            element.innerHTML = 'Error';
        }
        else {
            element.innerHTML = copyText;
        }
        document.getElementById('result').innerHTML = JSON.stringify(event);
    });
});

Any ideas?

@JamesMGreene
Copy link
Member

Can you provide your full ZeroClipboard state information for each browser? Run the following from the developer console (or output it into some HTML element, if you prefer):

console.log( JSON.stringify( ZeroClipboard.state(), null, 2 ) );

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants