Wednesday, 5 June 2019

Copy Current url to clipboard using Javascript


function copyLinkWhatsup()
    {

        var dummy = document.createElement('input'),
          text = window.location.href;
        document.body.appendCh
ild(dummy);
        dummy.value = text;
        dummy.select();
        document.execCommand('copy');
        document.body.removeChild(dummy);
        alert('Link copied please open whatsup and paste to send');
    }


2 comments:

  1. Copy Current url to clipboard using Javascript. Nice code, thanks!

    ReplyDelete
  2. Thanks alot...you save my day

    ReplyDelete