Skip to content

Commit

Permalink
Added bookmarklet copy-title.js
Browse files Browse the repository at this point in the history
  • Loading branch information
dmotte committed Sep 27, 2024
1 parent e38d0a4 commit 80dd526
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bookmarklets/copy-as-link.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Bookmarklet to copy a page URL and title as link (in rich text format) to
// Bookmarklet to copy the page URL and title as link (in rich text format) to
// the user's clipboard

// javascript:(function(){
Expand Down
16 changes: 16 additions & 0 deletions bookmarklets/copy-title.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Bookmarklet to copy the page title to the user's clipboard

// javascript:(function(){

const content = document.title;

navigator.clipboard
.writeText(content)
.then(() => {
alert(`Copied to clipboard:\n\n${content}`);
})
.catch((error) => {
alert("Error copying to clipboard: " + error);
});

// })();

0 comments on commit 80dd526

Please sign in to comment.