Skip to content

Roles in one tab

For example, an administrator keeps all of their roles in one tab and looks at the site as an editor in another. In the second tab they clear Administrator, tick Only in this tab and press Apply. That tab's address now ends with ?roles_off=administrator, and the first tab is unchanged.

The mode is off by default. Turn it on at Configuration > People > Simple role toggler with Let users switch their roles in one browser tab only.

How it works

  • The roles are in the URL. The tab's URLs carry the roles switched off: ?roles_off=administrator, or ?roles_off= for every role on. They win over the session's roles. The session and the remembered choice are left alone.
  • A script carries them. It adds them to the links, the forms and the Ajax requests of each page. It comes with the role form, so it runs only on pages that show the form: the Simple role toggler blocks, the toolbar tab or the form's own page.
  • Redirects. A redirect made by the server drops the roles. The next page loads again with them when the browser says which page it came from.

Leaving the tab's roles

  • Back to my usual roles in this tab goes back to the session's roles.
  • Choosing roles without Only in this tab sets them for the session, and leaves the tab's roles too.
  • Opening a URL without the roles in that tab, from the address bar or a bookmark, leaves them, and closing the tab forgets them.

Limits

  • A site that sends Referrer-Policy: no-referrer loses the tab's roles at each server redirect.
  • Links added by other scripts get the roles when they are clicked. Requests that other scripts make with fetch() do not.
  • With the setting off, a roles_off query is ignored and nothing extra runs.