User script
Copy comment link to clipboard
DescriptionFacilitates copying a wikitext link to the clipboard that links to a specific discussion comment, or to a heading
Author(s)isaacl
Statusbeta
First releasedJuly 21, 2023; 6 months ago (2023-07-21)
Version0.2.0
UpdatedJuly 21, 2023; 6 months ago (2023-07-21)
Browser supportsee § Browser support
SourceUser:isaacl/script/copy-comment-link-to-clipboard.js

The User:Isaacl/script/copy-comment-link-to-clipboard script provides a way to copy link wikitext to the clipboard that links to a specific discussion comment, or to a heading.

A popup with the wikitext link is displayed when the target text is clicked.

Note the text copied to the clipboard does not contain surrounding square brackets: [[ ]]

To install, you can use the script installer gadget, or add the following text to your common.js file:

mw.loader.load('https://en.wikipedia.org/wiki/User:Isaacl/script/copy-comment-link-to-clipboard.js?action=raw&ctype=text/javascript', 'text/javascript');

A "Toggle link2clipboard" item is added to the tools menu. Clicking on it will display the targets to copy the link wikitext. Clicking again will clear the targets.

Browser support

Based on MDN's "Interact with the clipboard" page, this script supports all browsers categorized as Grade A by the MediaWiki development team except Safari and Safari on iOS.

On Safari browsers, the wikitext link will not be copied to the clipboard automatically. Instead, it can be manually copied manually from the popup.