0

Copy to clipboard is working on Chrome, Firefox browser on both mobile and desktop. But not working on MI browser and DuckDuckGo Browser(Mobile Browsers).

Here is my js code

<script>
//copy
$(document).ready(function(){
        $(document).on("click",".copy_link", function(){
            var copyText = $(this).data('id');   
            navigator.clipboard.writeText(copyText);
        })
})
</script>

And here is my HTML code

<button class="copy_link" data-id="https://msort.ml/<?php echo $row['link']; ?>" >Copy</button>

I've tried other methods but I didn't get another method to copy from .class.

Here is my website snapshot

Website

Mayur Fartade
  • 307
  • 2
  • 12

1 Answers1

0

These browsers do not support the Asynchronous Clipboard API.

Adarsh C
  • 126
  • 2
  • So how to do it. I have used bitly.com, copy option of bitly is woking on DuckDuckGo and MI Browser. – Mayur Fartade May 06 '20 at 09:45
  • 1
    More details: https://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript?rq=1 – Jsowa May 06 '20 at 10:23