Browse the docs

frontBrowserIsComplete

Returns 1 when the front browser, whichever of Safari and Chrome was most recently in front has finished loading its current tab, otherwise 0.

Keyboard Maestro: FRONTBROWSERISCOMPLETE

Details #

frontBrowserIsComplete() takes no arguments and returns a number: 1 when the page in the current tab of the front window reports document.readyState as complete, 0 while it is still loading.

It asks the front browser, whichever of Safari and Chrome was most recently in front, so it runs a small piece of JavaScript in the tab.

Parameters #

Takes 0 arguments. {{ frontBrowserIsComplete() }}

Examples #

frontBrowserIsComplete()
→ 0

Gotchas #

  • Needs Automation permission for the browser (System Settings, Privacy & Security, Automation). Without it, or when the browser isn't running, the answer is 0.

  • A 0 also comes back when the tab can't be read, so it can't tell "still loading" from "no browser".

  • Passing an argument is an error: frontBrowserIsComplete() takes 0 arguments, got 1.