Mac OS
You can use org-mac-link.el, it produces an Org link since it can know not only URL but also TITLE by using AppleScript. You can install it via
- Install
org-plus-contrib
from Org ELPA
- or install
org-mac-link
from MELPA
- or
contrib/lisp/
under Org source code (get it via Git repo or tarball)
by the way, even you install via ELPA, you still need to setup autoloads for commands you need or simply require the feature since org-mac-link.el
doesn't setup its autoload cookies.
GNU/Linux
As far as I know, X11 doesn't provide tool like AppleScript. So you need to do it manually or some automation tool. For example, to get URL:
- Switch to Google Chrome
- Move cursor to Address Bar and select (or copy) URL
- Switch to Emacs (or Terminal if you are running Emacs in it)
- Yank from PRIMARY selection (or clipboard)
You can use tools such as xdotool(1)
to simulate the above steps, I tried this way a few days ago in grab-x-link.el, it supports Firefox and Chromium but not Chrome, it works for me in most cases.
There is also org-protocol.el. Basically, you register a URL scheme / protocol for emacsclient, then you find some way (such as Bookmarklet in web browser) to activate URL in that scheme.