Help with a basic addon - put custom hyperlink on clipboard

Greetings,

I know nothing about building addons for a browser, but I do have some decent technical skills. Just hoping someone can help point me in the right direction.

I do a lot of work in service now and I’m constantly copy/pasting the record ID, then making it a hyperlink because I’m just a nice guy and I want people to easily click on things in my chat/emails.

Manually, that means I have to copy/paste the record ID first (say it’s into an email) then go back, copy the URL, and then make a hyperlink in my email. It’s just way too much effort and seems like there should be a way to make this easier.

I was thinking a basic addon that could look for a pattern like “Request Number”, then grab the value, combine it with the URL of the page I’m on, and place a formatted HTML link in my clipboard.

I’d greatly appreciate any help/advice/thoughts to help achieve this.

If you want to extract data from a website, you’ll want to use a Content Script. To access the URL of the current tab, you can use the tabs API with the activeTab permission.

As to how to trigger it, you will likely want some kind of manual interaction to trigger it: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface

See https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard#writing_to_the_clipboard for details on writing to the clipboard.

Thanks, I’ll look into the links you’ve provided.

For the trigger, I was wondering if I could just make it ‘ctrl+c’. Is it possible to do something like

If domain = *.service-now.com AND clipboard.copy = INCXXXXXXXX
then grab URL and modify clipboard