Copy to Clipboard is Not Working in safari

varun tanwar picture varun tanwar · Dec 13, 2015 · Viewed 10.6k times · Source

Below is my code to "copy to clipboard" everything is workingfine with except its not working on safari browser... please help

<textarea id="mcq1" style="width:1px; height:1px; opacity:0; position:absolute;">
    <iframe src="http://s.rabblerapp.com/widget/widget.php?raw_uuid=de8c6880-9624-4b1d-8905-a3e2ab290660" style="width:100%;height:635px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0"></iframe>
</textarea>

<button class="rb_mcqbtn btn" data-clipboard-action="copy" data-clipboard-target="#mcq1" onclick="show_area('copied');">Copy Embed Code</button>

This is javascript i have use for this... https://zenorocha.github.io/clipboard.js

Answer

Josh Murray picture Josh Murray · Dec 13, 2015

I had a look at their site..

Look here: link

This library relies on both Selection and execCommand APIs. The second one is supported in the following browsers.

images here.....

Although copy/cut operations with execCommand aren't supported on Safari yet (including mobile), it gracefully degrades because Selection is supported.