Browse the docs

A page expression is true

Passes when a JavaScript expression evaluated in the page is truthy.

A page expression script is true

Details #

Evaluates script in the page (in world main, the page's own objects, by default) and passes when the result is truthy. It needs Allow User Scripts for Switchboard in Chrome; without that the condition fails and says so.

Parameters #

ParameterTypeRequiredValuesWhat it does
scripttextYesA JavaScript expression. Required.
sampleany value
tabany valueWhich tab.
worldone ofmain isolatedmain (default) or isolated.

Examples #

Only when the user is signed in
Only if
  1. If the page expression “!!document.querySelector('.avatar')” is true
Do
  1. Show “Signed in” for 1 s
Open in Switchboard to try it

Gotchas #

  • It runs the expression in the page for real, so keep it free of side effects.