Browse the docs

A page loads, changes or closes

Runs the macro when a page in Safari or Chrome starts or finishes loading, changes its address, comes to the front, closes or fails.

A page event

Details #

A browser trigger is reported by the Switchboard extension in your browser, only for the addresses some macro asked about, so the rest of your browsing never reaches Switchboard.

event is one of:

  • loading: the page started loading, before it paints. A macro that starts with Put CSS, HTML or JavaScript in the page steps that use no variables and no tab has those steps applied by the browser itself at this moment, with no round trip and even with Switchboard off (the editor labels them "Runs instantly in the page").

  • loaded: the page's DOM is ready (the default).

  • idle: the page finished loading and the network was quiet for half a second.

  • urlChanged: a single-page app changed its address without reloading.

  • activated: the tab came to the front.

  • closed: the tab was closed.

  • failed: the page did not load, or the server answered with an error (400 and above).

The run starts with browser, tabId, windowId, url, title, incognito, event, and status, error or previousUrl when they apply. {{triggerValue}} is the address.

Parameters #

ParameterTypeRequiredValuesWhat it does
eventone ofloading loaded idle urlChanged activated closed failedOne of loading, loaded, idle, urlChanged, activated, closed, failed. Default loaded.
matchrecordbrowser title urlWhich pages. url is a pattern (https://*.github.com/*/pull/*), a plain start (github.com/apple) or /regex/; title is text (any case) or /regex/; browser is safari, chrome or any.

Every trigger also takes Limits: a cooldown, the first time each day, every nth time, twice within seconds, a chance, only while you are at the Mac, on one Mac, or in a State. See Limits on any trigger.

Examples #

Say hello on every GitHub pull request
When
  1. A page on github.com/*/pull/* loads
Do
  1. Show “Pull request: {{title}}” for 2 s
Open in Switchboard to try it

Gotchas #

  • Pages in private windows are skipped unless Settings ▸ Browsers allows them; the Activity window then says why.

  • closed has the last address the extension saw, because a closed tab can't be asked.

  • Chrome pages like chrome://settings and the Web Store don't let any extension in, so no event comes from them.