The store-link protocol
Using the store-link handler, you can copy links, to that they can be inserted using M-x org-insert-link or yanking. More precisely, the command
lisp
emacsclient "org-protocol://store-link?url=URL&title=TITLE"stores the following link:
[[URL][TITLE]]In addition, URL is pushed on the kill-ring for yanking. You need to encode URL and TITLE if they contain slashes, and probably quote those for the shell.
To use this feature from a browser, add a bookmark with an arbitrary name, e.g., ‘Org: store-link’ and enter this as Location:
bash
javascript:location.href='org-protocol://store-link?' +
new URLSearchParams({url:location.href, title:document.title});Title is an optional parameter. Another expression was recommended earlier:
bash
javascript:location.href='org-protocol://store-link?url='+
encodeURIComponent(location.href);The latter form is compatible with older Org versions from 9.0 to 9.4.