Last active
October 18, 2024 04:03
-
-
Save aont/c4e0303b3aa52c9ece51d9a17084f009 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
const elem = document.createElement("a"); | |
elem.href = location.href; | |
elem.innerText = document.title; | |
document.body.appendChild(elem); | |
try { | |
const range = document.createRange(); | |
range.selectNodeContents(elem) | |
const selection = window.getSelection(); | |
selection.removeAllRanges(); | |
selection.addRange(range); | |
document.execCommand("copy"); | |
} finally { | |
document.body.removeChild(elem); | |
} | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(){const elem=document.createElement("a");elem.href=location.href,elem.innerText=document.title,document.body.appendChild(elem);try{const range=document.createRange();range.selectNodeContents(elem);const selection=window.getSelection();selection.removeAllRanges(),selection.addRange(range),document.execCommand("copy")}finally{document.body.removeChild(div)}}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment