Skip to content

Instantly share code, notes, and snippets.

@hexium310
Last active April 17, 2022 10:38
Show Gist options
  • Save hexium310/ca2dbf3a4aaceefdaf8122fd2e25713a to your computer and use it in GitHub Desktop.
Save hexium310/ca2dbf3a4aaceefdaf8122fd2e25713a to your computer and use it in GitHub Desktop.
Copy title and URL to clipboard
javascript:{const t=document.title+" "+location.href,o=t=>{window.prompt("",t)};navigator?.clipboard?.writeText(t).catch(()=>{o(t)})||o(t)}
(() => {
const content = `${ document.title } ${ location.href }`;
const showPrompt = (content) => {
window.prompt('', content);
};
navigator?.clipboard?.writeText(content).catch(() => {
showPrompt(content);
}) || showPrompt(content);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment