두 가지 이상의 .HTML 파일을 넘나들 때, 웹 페이지를 공유할 때
<script> function back(){ let url = window.location.href; let new_url = url.split('result.html')[0] + 'index.html'; window.location.href= new_url; } </script>
<script> function share(){ var t = document.createElement("textarea"); document.body.appendChild(t); t.value = window.location.href; t.select(); document.execCommand('copy'); document.body.removeChild(t); alert('복사 완료!') } </script>
끝 :)