RTO_openTab_button.js

Helper file documentation for RTO_openTab_button.js.
Docs updated: 2025-12-17

Summary

Bind buttons to open/navigate/focus a remote tab.

  • Exports: RTObindTabButtons
  • Depends on: RTO_form_api.js
  • Uses data attributes: data-rto-closed-text, data-rto-key, data-rto-open-focus, data-rto-open-text, data-rto-poll, data-rto-refresh-focus, data-rto-tabKey, data-rto-url, data-rto-when-open

What it is

Binds buttons and links to tab actions using data-rto-* attributes (no custom click handler required).

Download

Download RTO_openTab_button.js

Data attributes

  • data-rto-url (required)
  • data-rto-tabKey or data-rto-key (required)
  • data-rto-when-open: focus (focus existing tab) or refresh (navigate to URL again, then focus)
  • data-rto-open-focus: 1 to focus after opening
  • data-rto-refresh-focus: 1 to refresh URL (cache-bust) and focus when already open
  • data-rto-open-text, data-rto-closed-text: optional label switching
  • data-rto-poll: polling interval ms for state updates (optional)

Example

<button
  data-rto-url="https://example.com/billing"
  data-rto-tabKey="billing"
  data-rto-open-focus="1"
  data-rto-when-open="focus"
>
  Open billing
</button>

<script src="../RTO_helpers/RTO_form_api.js"></script>
<script src="../RTO_helpers/RTO_openTab_button.js"></script>

Next