WEB/JS

현재 URL 클립보드로 복사하기(라이브러리X)

나나나나나나나ㅏ나난ㄴ나ㅏ나나 2020. 6. 24. 17:58
728x90

현재 URL을 라이브러리없이 클립보드로 복사하구싶을때??

 

    function copyLink(){

        let currentUrl = window.document.location.href;

        let t = document.createElement("textarea");
        document.body.appendChild(t);
        t.value = currentUrl;
        t.select();
        document.execCommand('copy');
        document.body.removeChild(t);
		
        alart('복사가 완료되었습니다');

    }

 

728x90