Browse the docs

browserSelection

Returns the text selected in the front browser's page.

Details #

browserSelection() takes no arguments and returns text: what is selected in the front tab of the front browser, or empty text when nothing is. With the browser extension connected it reads the page directly; without it, it asks the browser through AppleScript.

Parameters #

Takes 0 arguments. {{ browserSelection() }}

Examples #

browserSelection()
→

Gotchas #

  • Only the front tab of the front browser is read.

  • Some pages (a PDF viewer, a Chrome settings page) don't let extensions or scripts read a selection.