Context menu: Copy link with types

This example adds a context menu item to every link that copies the URL to the clipboard, as plain text and as rich HTML.

What it does

This extension includes:

To test the extension, right-click on any link to open a context menu, and choose the “Copy link to clipboard” option. Then open preview.html and paste the clipboard content in the two displayed boxes. The first box will display “This is text: …” and the second box will display “This is HTML: …”.

Note: since the add-on relies on a content script for copying the text, the copy operation will only succeed if the add-on is allowed to run scripts in the current page. If you wish to successfully copy the text even if the current page cannot be scripted, then you can open an (extension) page in a new tab as a fallback.

What it shows