1

I have the following code on my page that displays a text box with a copy button after it(places the contents on your clipboard)...

    public showDialog(): DataLab.Util.Promise<IDialogResult> {
        var p = DialogViews.ShowApiCode.show(this);
        $("#short-code").fxsCopyButton({
            ariaLabelledBy: "short-code-label",
            labelElement: $("#short-code-input"),
            getClipboardText: function () { return $("#short-code-text").val(); }
        });
        $("#short-code-text").click(function () {
            $(this).select();
        });
        return p;
    }

This good works fine in Safari and in Chrome, but in IE the text box is empty. I know that if I remove the following the text books works fine...

         $("#short-code").fxsCopyButton({

Is my best option here to do a switch based on the browser and just not do clipboard in IE? Can I am I doing something wrong here, or is there a better way to do copy to clipboard for all browsers?

Dan Ciborowski - MSFT
  • 6,807
  • 10
  • 53
  • 88

1 Answers1

1

You can use the clipboardData object instead:

http://msdn.microsoft.com/en-us/library/ie/ms535220(v=vs.85).aspx

securecodeninja
  • 2,497
  • 3
  • 16
  • 22