zeroclipboard icon indicating copy to clipboard operation
zeroclipboard copied to clipboard

Unable to get value of the property 'style'

Open milindrasal opened this issue 11 years ago • 22 comments

Hi I am getting following error in IE9

SCRIPT5007: Unable to get value of the property 'style': object is null or undefined ZeroClipboard.js, line 350 character 5

milindrasal avatar Jan 10 '14 11:01 milindrasal

Some more info.. I am using 1.2.3 version.

milindrasal avatar Jan 10 '14 11:01 milindrasal

Please share your JS setup code and Flash Player version info (from IE, specifically).

JamesMGreene avatar Jan 10 '14 13:01 JamesMGreene

following is my js Setup and flash player version is 11,9,900,170. the code is working on all other browsers but not working on IE 9. I have checked your demo on IE that also is not working on IE 9.

<script src="js/ZeroClipboard.js"></script>
<script type="text/jscript">
  $(function () {
    var clip = new ZeroClipboard(
      document.getElementsByClassName('copyCodeButton'),
      { moviePath: "ZeroClipboard.swf" }
    );
    clip.on('complete', function(){
      $('.promoCode').hide();
      $('.message').show();
    });
  });
</script>

milindrasal avatar Jan 10 '14 13:01 milindrasal

When you say that the demo page isn't working, can you describe the behavior it is exhibiting? Is it failing to load, throwing/logging errors, or just not copying to your clipboard?

JamesMGreene avatar Jan 10 '14 14:01 JamesMGreene

Are you certain that your moviePath is correct? Looks like your JS file is in a "js" folder but your SWF is in the same folder as the HTML page. Is that correct?

JamesMGreene avatar Jan 10 '14 14:01 JamesMGreene

it not copying to clipboard.. and moviePath is correct.. JS file is in js folder and SWF is with HTML page.

milindrasal avatar Jan 13 '14 05:01 milindrasal

Ah, as far as the demo page goes, this looks like an IE-specific script execution order issue. :-1: I'll get that fixed.

As to your particular issue, I'm unsure.

JamesMGreene avatar Jan 13 '14 16:01 JamesMGreene

I have upgraded IE version to 11 but still it's ZC working on IE. your given link "IE-specific script execution order" is not working too.

milindrasal avatar Jan 14 '14 11:01 milindrasal

Hi I have downloaded the Flash Player Version 12 for IE and installed it. Code is working fine now.

link for Flash player: http://get.adobe.com/flashplayer/otherversions/

milindrasal avatar Jan 14 '14 12:01 milindrasal

Hmm, very curious.

JamesMGreene avatar Jan 14 '14 15:01 JamesMGreene

Demo page is hopefully fixed by zeroclipboard/zeroclipboard.org@547ce769f71c7350e9600ac837afbb855d262e77.

JamesMGreene avatar Jan 14 '14 16:01 JamesMGreene

Nope. :anger:

JamesMGreene avatar Jan 14 '14 16:01 JamesMGreene

Try-try-again: zeroclipboard/zeroclipboard.org@f29dd2994d44ed52dd87532349f332884fc340a6

JamesMGreene avatar Jan 14 '14 16:01 JamesMGreene

This seems to make it work for me in IE7, IE9, IE10, and IE11... but IE8 only works intermittently.

JamesMGreene avatar Jan 14 '14 16:01 JamesMGreene

I can confirm this on IE9 and IE10. It works on IE11. zc script error ie9-10 zc js line 350 script5007

Now, it's also the case that my IE9 and IE10 are running on modern.ie Win7/IE VMs, and thus are not in the domain. My IE11 is running in the domain. I had to adjust security settings to get my AJAX services to work from that environment, so I don't rule out some security issue, though there's nothing in the F12 console.

It's probably obvious, but the movie doesn't appear to be loading in IE9 or 10. It's not showing up in the Network tab of the F12 tools. It does show up in IE11. Maybe that's implied by htmlBridge==null?

JohnWSaundersIII avatar Jan 14 '14 19:01 JohnWSaundersIII

@JohnWSaundersIII: Any chance you can test with the new v1.3.0-beta.1 beta release?

Or reproduce this using the demo page for that beta release? http://zeroclipboard.org/?release=beta&type=traditional

JamesMGreene avatar Jan 14 '14 19:01 JamesMGreene

I have just tried this with v1.3.1. I got it to work ok with Firefox 26 and IE 11, but it doesn't work for IE9.

Now, it doesn't crash with IE9 like it used to - it just doesn't actually clip the movie to the element.

Briefly, here are the changes I had to make to get it to work with FF26:

  1. Change ZeroClipboard.setDefaults to ZeroClipboard.config

  2. Change client.glue to client.clip

  3. Change client.unglue to client.unclip

  4. Change my dataRequested handler from

        zeroClipboardClient.on('dataRequested', function (client) {
            if (client.options == null || client.options.text == null) {
                client.setText($(this).text());
            }
    

    to

        zeroClipboardClient.on('dataRequested', function (client) {
            var text = $(this).attr("data-clipboard-text");
            if (text) {
                client.setText(text);
            } else {
                client.setText($(this).text());
            }
        });
    

And, of course, I updated the two .js files and the .swf file.

JohnWSaundersIII avatar Jan 25 '14 04:01 JohnWSaundersIII

Changes 1-3 aren't required but are recommended (if you just want to suppress the console warnings, you can just set the debug option to false).

Change 4 isn't a big surprise as client.options.text was never an official/intentional part of the API, and thus I paid no heed in removing it. However, you should be able to shorten it slightly to the following:

zeroClipboardClient.on('dataRequested', function (client) {
  var $this = $(this);
  if (!$this.attr("data-clipboard-text")) {
    client.setText($this.text());
  }
});

JamesMGreene avatar Jan 27 '14 03:01 JamesMGreene

Is there anything else I can do to help you find and fix this problem? There is talk of shipping without copy to clipboard functionality as opposed to shipping with a release note saying "it doesn't work on IE9/10", and "you have to click in the first half of the text" (issue #330).

JohnWSaundersIII avatar Jan 28 '14 14:01 JohnWSaundersIII

@JohnWSaundersIII You never explicitly answered: does the demo page work in IE9/10?

JamesMGreene avatar Jan 28 '14 15:01 JamesMGreene

Interesting results playing around with the demo page on Windows. It works for me in IE11 and IE11-as-IE10/9/8. Doesn't seem to work in IE11-as-IE7. Only works intermittently in IE10 and IE10-as-IE9/8/7. Perhaps this is the wiley Issue #236 back to haunt me...?

JamesMGreene avatar Jan 28 '14 17:01 JamesMGreene

Note to self: Should retry this with the latest v2.x release.

JamesMGreene avatar Dec 01 '14 17:12 JamesMGreene